Request ServerVariables Common Task

ASP.Net Get IP address for website

Get the IP address for the website.
You want to retrieve the IP address of the website that the request came to. Do not use "SERVER_NAME" or "HTTP_HOST", use "LOCAL_ADDR". The IP address returned is the IP address that the request came in to. A website might have several IP addresses.
string ipAddressToWebSite = Request.ServerVariables["LOCAL_ADDR"]);
Dim ipAddressToWebSite As String = Request.ServerVariables("LOCAL_ADDR")
Related ServerVariables LOCAL_ADDR
     << Back