Let\'s say I\'m hosting a website at http://www.foobar.com.
Is there a way I can programmatically ascertain \"http://www.foobar.com/\" in my code behind (i.e. witho
--Adding the port can help when running IIS Express
Request.Url.Scheme + "://" + Request.Url.Host + ":" + Request.Url.Port
I know this is older but the correct way to do this now is
string Domain = HttpContext.Current.Request.Url.Authority
That will get the DNS or ip address with port for a server.