Question
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?
Answer
Perhaps this might work:
String RelativePath = AbsolutePath.Replace(Request.ServerVariables["APPL_PHYSICAL_PATH"], String.Empty);
(i'm using c# but could be adapted to vb)
(@Tags2k: I have editted the above answer)
< br > via < a class="StackLink" href=" http://stackoverflow.com/questions/3164/" >Absolute path back to web-relative path< /a>
0 comments:
Post a Comment