AsiaTech: Microsoft APGC Internet Developer Support Team

We focus on various troubleshooting plan and solution on IIS web platform and distributed applications

Case Study: User request is always redirected to the login page of the Form Authentication

Case Study: User request is always redirected to the login page of the Form Authentication

Rate This
  • Comments 1

 

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.

clip_image002

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:

clip_image004

We found the computer name was “Test_Computer” which contains an underscore (_)

According to the following article IE would *not* send the cookie.

http://blogs.msdn.com/b/ieinternals/archive/2009/08/20/wininet-ie-cookie-internals-faq.aspx?PageIndex=5

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.

Conclusion

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)

Regards,

Xin Jin from APGC DSI Team

Leave a Comment
  • Please add 4 and 7 and type the answer here:
  • Post
  • Great post.

    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!

Page 1 of 1 (1 items)