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

added by mostafafn
5/14/2010 6:13:13 AM


Sometimes you need to resolve URL, but you don’t have the Page.ResolveUrl() function in your context. One example is in the Web Service or Handlers. A real world example could be you have a web service that will do data binding for a grid, and you need to generate edit/preview links for grid items, so you need to convert “~/path-to-data.aspx” to something such as “/Website/path-to-data.aspx”, so you need to know what the virtual path of the current application is.