I am looking for a way to resolve a relative url the way you would with a page or control instance (MSDN Docs) such as:
Page.ResolveUrl("~/common/Error.aspx");
...but when I only have an HttpContext available to me, such as when I am in a HttpHandler.
Will I need to use a custom function, such as the one seen here?
Or is there a way to get at the underlying function used by the Page.
Try to get the page from the handler and use
ResolveUrl
, or create a Control object...Or use
VirtualPathUtility.ToAppRelative(string)
orVirtualPathUtility.ToAbsolute(string)
For example:
returns