0

我搜索了很多,但找不到如何解决我的问题。我有一个 asp:Login 控件来登录到 CMS 系统。它作为一个星期的魅力发挥了作用,而不是突然我无法登录更多。这发生在同一台机器,同一个数据库上。

我创建了新用户、新角色、新的一切,但总是写着“您的登录尝试不成功。请再试一次。”

然后我尝试处理 LoginError 事件,就像这里描述的4guysFromRolla和 debugged 一样,但它不会在 IsLockedOut() 或 IsApproved() 上停止。即使在数据库表 Membership 中,所有 IsLockedOut 设置为 false 并且所有 IsApproved 设置为 true:

这是 web.config 部分

<compilation debug="true">
<authentication mode="Forms" />
<machineKey decryption="AES" validation="SHA1" decryptionKey="1513F567EE75F7FB5AC0AC4D79E1D9F25430E3E2F1BCDD3370BCFC4EFC97A541" validationKey="32CBA563F26041EE5B5FE9581076C40618DCC1218F5F447634EDE8624508A129"/>
<membership defaultProvider="SimpleCMSSqlMembershipProvider">
  <providers>
    <add name="SimpleCMSSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
      connectionStringName="SimpleCMS1ConnectionString"
      enablePasswordRetrieval="false"
      enablePasswordReset="true"
      requiresQuestionAndAnswer="true"
      applicationName="/"
      requiresUniqueEmail="false"
      passwordFormat="Hashed"
      maxInvalidPasswordAttempts="5"
      minRequiredPasswordLength="5"
      minRequiredNonalphanumericCharacters="0"
      passwordAttemptWindow="10"
      passwordStrengthRegularExpression=""/>
  </providers>
</membership>

 <connectionStrings>
     <add name="SimpleCMS1ConnectionString" connectionString="Data Source=CENE\SQLEXPRESS;Initial   Catalog=SimpleCMS1;Persist Security Info=True;User ID=SimpleCMSUser;Password="aaaaaa"
       providerName="System.Data.SqlClient" />
     <add name="SimpleCMS1ConnectionString1" connectionString="Data Source=CENE\SQLEXPRESS;Initial Catalog=SimpleCMS1;User ID=sa;Password=aaaaaaaa"
      providerName="System.Data.SqlClient" />
  </connectionStrings>

<roleManager enabled="true">
  <providers>
    <clear />
    <add connectionStringName="SimpleCMS1ConnectionString" applicationName="/"
      name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
  </providers>
</roleManager>

有什么建议吗,谢谢

4

1 回答 1

0

如果您仅使用此行<authentication mode="Forms" />进行身份验证设置,那么这可能是您的问题。你必须有类似的东西:

<authentication mode="Forms">
  <forms name=".klidi" loginUrl="~/login.aspx" protection="All" 
         timeout="10" path="/" requireSSL="true" 
         cookieless="UseCookies" 
         domain="yourdomain.com" enableCrossAppRedirects="false" slidingExpiration="true" />
</authentication>

不要让它随机工作,而是设置你的参数。

对于requireSSL="true"参数,请阅读此问题某些黑客可以从用户那里窃取 cookie 并在网站上使用该名称登录吗? . 如果您保留它,请确保使用 ssl 页面,否则登录将始终失败。

于 2013-02-02T19:15:34.683 回答