Using ASP.NET how can I convert a absolute path to a relative client path?
Eg.: Today I have a address like that: 'c:\web\site\im开发者_JAVA技巧ages\somefile.some' I want to convert to "/site/images/somefile.some", It is worth to say that "site", "images" and somefile.some may change.
This Question will help you: Absolute path back to web-relative path
That said, why are you using an absolute path rather than the ~/ which is suggested?
For example, if you use "~/images/somefile.some" and pass it to the [Control].ResolveUrl(url as string) method, then it would translate that into the path for somefile.some based on the root of the directory.
精彩评论