A custom ASP.NET application running on IIS 7.5 (Windows 2008 R2) is using Form Authentication.
The user reported that the request was always redirected to the login page after he input the correct user name and password.
He noticed that the problem only existed when he used the computer name to access the application. He did not experience this issue if he used IP address.
We captured the network trace and found the IIS server redirected the user request to Default.aspx after the user posted the user name and password. The server also set .ASPXAUTH cookie because the user was authenticated.
The subsequent request was to Default.aspx. However this request did not contain .ASPXAUTH cookie. Therefore the IIS server would redirect the request to login page again:
We found the computer name was “Test_Computer” which contains an underscore (_)
According to the following article IE would *not* send the cookie.
Q5: IE won’t set a cookie when the hostname/domain contains an underscore?
A: Correct. Technically, an underscore (like this _ ) is not a DNS character, and while Windows will let you use an underscore when naming your machine, it warns you that doing so may cause problems. One such problem is that WinINET blocks attempts to set cookies on such domains. See http://support.microsoft.com/kb/316112/en-us
The solution is to rename the computer.
We need to pay attention to the host header if IE did not send the cookie.
(Firefox and Chrome will still send the cookie in this scenario)
Xin Jin from APGC DSI Team
I experienced this problem first hand a few years ago. Took me quite a while to figure out what it was back then.
Let's hope your post can help others find the problem and solution faster!