Forms Authentication fails to recognize as logged in under IE when underscore in hostname

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-02 04:05:24

问题


In my asp.net webforms application I am using plain and simple forms authentication hooked up into my database (with the standard membership provider). Everything works well, I can log in , log out, get roles, etc...

However, after deploying my site to the intranet IIS server I noticed that IE cannot be authenticated. The actual authentication process for logging in works (as it does tell you when your password/username is wrong) but after authentication completes it claims you aren't logged in.

This is only on my deployed IIS environment as locally while in my VS environment everything works just fine in IE. While in the deployed IIS chrome and Firefox work just fine.

The only thing I can tell is it looks like IE isn't getting or saving the authentication cookie. This is not IE setting related as I have my IE8 set to accept all cookies, and I tested on a coworker's IE8 machine and another's IE7 with the same results.

My web.config is using the following settings:

<authentication mode="Forms" >
  <forms cookieless="UseCookies" />
</authentication>  

Does anyone at least have a clue on where I would look to begin debugging this issue?

Thanks,


Edit: I have been forced to fix this issue now, since my webserver is not working well with URL authentication.

I have used fiddler and figured out that IIS7 is not sending any cookies to me when I am in IE. No cookies are in the headers. The cookies are correctly in the headers when serving the site to Mozilla and Chrome browsers though. I am at a loss as to why.....


Edit2: As a side note, when I log into the web server directly, if I go to Http://localhost/ IIS sends IE the cookies fine, but if I go to http://qa_build/ (that's the computer name for the server) IIS won't send the cookies to IE.


回答1:


Finally figured out the answer. It turns out if the domain has an underscore in it, Internet Explorer will not store cookies. Changing the computer's name to qabuild fixed it.

http://support.microsoft.com/kb/316112




回答2:


Is there another submit button on the page somewhere that is not related to the login?

I had a similar problem when trying to log in once, and discovered it only happened when I hit enter instead of clicking the login button, and it was being caused by another button taking the default button click. It would authenticate, but it would not give me any user roles.



来源:https://stackoverflow.com/questions/3144394/forms-authentication-fails-to-recognize-as-logged-in-under-ie-when-underscore-in

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!