Cheraq.com

I innovate, then I am!

Thursday, May 26, 2011
by Mohammad J.
0 comments

How to resolve URL to absolute path when you don’t have access to page object?

Using Virtual Path will make web applications more portable. If you don’t know what I mean by virtual path, it is simply URLs that start with “~/”. But resolving this URLs to absolute path something might be tricky. ASP.NET’s Page object provides a convenient function “ResolveUrl()” that does this for us, but what if we do not have access to this object?! For example Web Service or Generic Handlers do not provide this functionality. If you are wondering how to achieve this in such situations, then you are on right track. Continue reading