Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you 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?

like image 729
Guy Avatar asked Jan 21 '26 02:01

Guy


1 Answers

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)
like image 148
Alexander Kojevnikov Avatar answered Jan 22 '26 17:01

Alexander Kojevnikov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!