Request ServerVariables Common Task

ASP.Net Get name of website

Get the host name of the website.
You want to retrieve the host name of the website that the request came to. Do not use "HTTP_HOST", use "SERVER_NAME". The name returned is the websites configured name.
string nameOfWebSite = Request.ServerVariables["SERVER_NAME"]);
Dim nameOfWebSite As String = Request.ServerVariables("SERVER_NAME")
Related ServerVariables HTTP_HOST SERVER_NAME
     << Back