Is there a fast way to get the scheme, host, port (only if not 80) and application path in ASP.NET?
As far as I know, I need to assemble the following pieces:
Isn't there a simple property for that?
This should work:
Request.Url.GetLeftPart(UriPartial.Authority) + Request.ApplicationPath
Note that this may or may not end with a trailing "/" depending on if your app is hosted in the root of the site or in a sub directory.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With