ASP.NET:是虚拟路径吗?
是否有函数可以判断 URI 是否为有效的虚拟路径?我得到了一个字符串,当该字符串不是有效的虚拟路径时,需要对其使用 Server.MapPath() 而不抛出异常。
投票结束我的问题。答案是@ asp.net - 我的路径是虚拟的吗?。
Is there a function to determine whether a URI is a valid virtual path? I'm given a string and need to use Server.MapPath() on it without throwing an Exception when the string is not a valid virtual path.
Vote to close my question. Answer is @ asp.net - Is my path virtual?.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用 File.Exists() 和 Directory.Exists() 方法检查 Server.MapPath() 的输出并验证文件/目录是否存在于指定路径。
You could use the
File.Exists() and Directory.Exists()
methods to check the output ofServer.MapPath()
and verify that a file/directory exists at the specified path.