在Internet Explorer中使用asp.net表单身份验证的问题

Dus*_*ges 4 asp.net authentication

我的公司有一个托管在客户机上的Web应用程序,它在ASP.net中使用表单身份验证.访问网站http://www.client.com/Application并尝试在登录页面上进行身份验证时,用户将被重定向回登录页面.通过http:// localhost/Application访问它时,身份验证工作正常,用户可以进入该站点.我们无法在开发环境中复制此行为,因此我们非常确定它与其服务器/环境有关.

只有在使用Internet Explorer(使用ie 6,7,8进行测试)时才会出现此问题.当客户端尝试使用Firefox时,身份验证工作正常.

我创建了一个调试页面,在调用FormsAuthentication.SetAuthCookie后,登录页面重定向到该页面,显示有关身份验证cookie的信息.在Internet Explorer中访问它时,身份验证cookie不存在.当它在FireFox中击中它时.

有没有人遇到过这样的事情,或者对可能出现的问题有任何建议?

编辑:

Web.config文件

<authentication mode="Forms">
  <forms name=".ASPXAUTH" loginUrl="Login.aspx" />
</authentication>
<authorization>
  <deny users="?" />
  <allow users="*" />
</authorization>   

 <!-- Page used to display authentication cookie information -->
 <location path="AuthDebugPage.aspx">
   <system.web>
     <authorization>
      <allow users="?"/>
     </authorization>      
   </system.web>
 </location>
Run Code Online (Sandbox Code Playgroud)

LogOn.aspx.vb

If (adAuth.IsAuthenticated(Domain, txtUserName.Text, txtPassword.Text)) Then          

  Dim AuthDebug As Boolean =      System.Configuration.ConfigurationSettings.AppSettings("AuthDebug")

  If AuthDebug Then
    FormsAuthentication.SetAuthCookie(SystemUserName, False)
    Response.Redirect("AuthDebugPage.aspx")
  Else
    FormsAuthentication.RedirectFromLoginPage(txtUserName.Text, False)
  End If
End If 
Run Code Online (Sandbox Code Playgroud)

他们的域管理员查看了组策略,看看他们是否正在将任何内容推送到他们的节点,阻止用户在IE上接受cookie并且他没有找到任何内容.他还从域中取出了一台机器并清除了所有组策略,并且仍然在Internet Explorer中进行身份验证时遇到同样的问题.

小智 6

当服务器日期/时间不正确并导致AuthCookie过期日期不正确时,我遇到了同样的问题.

检查服务器的日期/时间是否正确.


Dus*_*ges 5

约翰说这是环保的.我们启用了无cookie身份验证,并且工作正常,因此用户正在进行身份验证.我们的一位客户发现,当他们只使用IP地址访问网站时(例如http://111.111.111.111)网站表现正常并且他们能够通过登录页面但是当他们使用DNS名称时没有.在Internet Explorer中调出他们的区域确实允许对外部站点(DNS名称也解析了)的足够信任,因为它使本地Intranet站点有cookie.

  • 我仔细检查了我的DNS,我有一个下划线.对于到达这里的人,您也可以查看[post](http://stackoverflow.com/questions/3144394/forms-authentication-fails-to-recognize-as-logged-in-under-ie-when-underscore-在). (3认同)