I have a virtual path (example: \"~/Images/Banner.jpg\") and I want to make that an absolute web path (example: \"/ApplicationRoot/Images/Banner.jpg\"). There is a method tha
There are various ways that are available in ASP.NET that we can use to resolve relative paths to absolute Urls -
1) Request.ApplicationPath
2) System.Web.VirtualPathUtility
3) Page.ResolveUrl
4) Page.ResolveClientUrl
Here's a article that explains the difference between the various ways to resolving paths in ASP.NET -
Different approaches for resolving URLs in ASP.NET
Control.ResolveClientUrl(url)
or
Control.ResolveUrl(url)
Whichever one you need (honestly I dont know the difference, as both seem to return mostly the same, perhaps someone can illuminate me :) ).
System.Web.VirtualPathUtility.ToAbsolute("yourRelativePath");
There you go :)