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


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?



To get the base URL you can use:

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