绝对路径回相对网络路径 [英] Absolute path back to web-relative path
本文介绍了绝对路径回相对网络路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果我成功地找到并使用验证使用Server.Mappath文件的存在,我现在想给用户直接发送到该文件,究竟是在最快的方式转换了绝对路径回到相对路径网络
If I have managed to locate and verify the existence of a file using Server.MapPath and I now want to send the user directly to that file, what is the fastest way to convert that absolute path back into a relative web path?
推荐答案
也许这可能工作:
String RelativePath = AbsolutePath.Replace(Request.ServerVariables["APPL_PHYSICAL_PATH"], String.Empty);
\r
\r
的(我使用C#,但可以适用于VB)的
的(@ Tags2k:我已经editted上面的回答)的
这篇关于绝对路径回相对网络路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文