15 Oct 2007

How to resolve relative url’s without ResolveUrl

No Comments Uncategorized

Sometimes you need to resolve relative url’s without ResolveUrl. If the code is executing outside a Control, for example in an IHttpHandler or business layer code somewhere that has no reference to a Control, you can’t call Control.ResolveUrl.

The System.Web.VirtualPathUtility class has some very useful method for converting from an app relative path to an absolute path:

string absoluteUrl = VirtualPathUtility.ToAbsolute(relativeUrl);
Tags: , ,
written by
Nick Berardi
subscribe
If you found this post valuable and would like to see more like it you can follow me.
No Responses to “How to resolve relative url’s without ResolveUrl”

Leave a Reply