ASP.NET - Telling the difference between localhost and 127.0.0.1
Posted
by tyndall
on Stack Overflow
See other posts from Stack Overflow
or by tyndall
Published on 2010-06-17T21:52:46Z
Indexed on
2010/06/17
22:03 UTC
Read the original article
Hit count: 273
How can you tell the difference between a request going to 127.0.0.1 and localhost.
This line of code on Windows 7 and VS2010 built-in web server can not tell the difference.
if (Request.ServerVariables["SERVER_NAME"].ToLower() == "localhost")
{
}
try hitting your own built-in web server with: http://127.0.0.1/ and then http://localhost/
© Stack Overflow or respective owner