C# – How to find the base url from a DLL in C#

.netasp.netc++urlweb-applications

From within a DLL that's being called by a C#.NET web app, how do you find the base url of the web app?

Best Solution

Will this work?

HttpContext.Current.Request.Url

UPDATE:

To get the base URL you can use:

HttpContext.Current.Request.Url.GetComponents(UriComponents.SchemeAndServer, UriFormat.Unescaped)