Try to get the page from the handler and use ResolveUrl, or create a Control object…
(HttpContext.Current.Handler as Page).ResolveUrl("~/virtualpath");
Or use VirtualPathUtility.ToAppRelative(string) or VirtualPathUtility.ToAbsolute(string)
For example:
System.Web.VirtualPathUtility.ToAbsolute("~/Styles/Contoso.xslt");
returns
/WebSite/Styles/Contoso.xslt