How get the virtual path based on the physical path?



Server.MapPath("~/page.aspx") returns the physical file path based on
the specified virtual path. Is there any reverse method to get the
virtual path based on the physical path (both pathes belong to the
same web application)?
Usually I do in this way:

virtualFilePath =
physicalFilePath.Replace(physicalRootDirectoryPath,"~/")

Perhaps, is there standard inbuilt method?

Mykola
http://marss.co.ua

.



Relevant Pages

  • Server.MapPath & Request.MapPath
    ... Server.MapPath returns the physical file path that corresponds to the ... specified virtual path whereas Request.MapPath maps the specified ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Server.MapPath & Request.MapPath
    ... "The greatest danger for most of us is not that our aim is too high and we miss it, but that it is too low and we reach it" Michelangelo ... specified virtual path whereas Request.MapPath maps the specified ...
    (microsoft.public.dotnet.framework.aspnet)