I’m looking for the equivalent of this javascript
window.location.origin
but server side, while building mvc pages.
For example, if you are here
http://website.com/123,
it would return
http://website.com
Its important that i have the “http://” part
I’m a fan of
Keeps your Http/Https, Port (if applicable), and HostName/IP.
DotNetFiddle Examples
Updated to Account for PathAndQuery length of 1.