0

I used HttpContext.Current.Server.MapPath("~/Images/abc.jpg") to get the Windows Path for a file in my web application.

Now I want the reverse. From the windows path that I got, I want to get the web path that I had earlier passed as parameter to Server.MapPath. How to get it?

STLDev
  • 5,950
  • 25
  • 36
Brij
  • 11,731
  • 22
  • 78
  • 116
  • 1
    Possible duplicate? http://stackoverflow.com/questions/6081433/getting-relative-virtual-path-from-physical-path – StuartLC Jun 12 '13 at 06:41
  • 1
    possible duplicate of [Absolute path back to web-relative path](http://stackoverflow.com/questions/3164/absolute-path-back-to-web-relative-path) – mipe34 Jun 12 '13 at 07:28

1 Answers1

1

windowsPath.Replace(Request.ServerVariables["APPL_PHYSICAL_PATH"], String.Empty);

Found this at: Absolute path back to web-relative path

Community
  • 1
  • 1
Brij
  • 11,731
  • 22
  • 78
  • 116