asp.net - 我的路径是虚拟的吗?
是否有内置的 asp.net 方法来检查路径的“虚拟性”?
到目前为止,我能够做到这一点的唯一方法是使用以下 try 块:
public void Foo(String path){
try
{
path = Server.MapPath(path);
}
catch(HttpException){}
// do stuff with path
}
Is there a built-in asp.net method for checking the "virtualness" of a path?
The only way I've been able to do it so far is with the following try block:
public void Foo(String path){
try
{
path = Server.MapPath(path);
}
catch(HttpException){}
// do stuff with path
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Path.IsPathRooted 方法有效吗?
你得到的代码将是:
Would the Path.IsPathRooted method work?
You're resulting code would be:
以下是您需要了解的有关 ASP.Net 路径的所有信息: Rick Strahl 的帖子“理解 ASP.Net Pahts”
Here is everything you need to know about ASP.Net paths: Rick Strahl's post "Making Sense of ASP.Net Pahts"