Request ServerVariables Common Task

ASP.Net Get address for website

Get the address for the website.
You want to retrieve the full address of the website that the request came to. Do not use "SERVER_NAME", use "HTTP_HOST". The address returned is the name that the request came in to.

Example, for, SERVER_NAME would return whereas HTTP_HOST would return
string addressToWebSite = Request.ServerVariables["HTTP_HOST"]);
Dim addressToWebSite As String = Request.ServerVariables("HTTP_HOST")
Related ServerVariables HTTP_HOST SERVER_NAME
     << Back