Hi all, I seem to have found a discrepancy when testing ASP.NET applications locally on the built-in web server with Visual Studio 2008 (Cassini).
I've set up a host on my local machine associating dev.testhost.com with 127.0.0.1, since I have an application that needs to change its appearance depending on the host header used to call it.
However, when I request my test application using http://dev.testhost.com:1234/index.aspx
, the value of Request.Url.Host
is always "localhost"
. Whereas the value of Request.Headers["host"]
is "dev.testhost.com:1234"
(as I would expect them both to be).
I'm NOT concerned that the second value includes the port number, but I am mighty confused as to why the HOST NAMES are completely different! Does anyone know if this is a known issue, or by design? Or am I being an idiot?!
I'd rather use - Removed due to possibly causing confusion! - SamRequest.Url.Host
, since that avoids having to strip out the port number when testing...