asp.net登录控件不起作用

时间:2011-05-25 15:08:17

标签: c# asp.net login

我放了一个登录控件,它不会让我进入网站。 (我甚至尝试使用登录控制来检索和重置密码。仍然无法工作)。

以下是我的web.config文件的一部分。昨天,我通过更改add标签中的属性修复了这个问题。但是今天问题重演了。

http://go.microsoft.com/fwlink/?LinkId=169433    - >

                                      

     <add name="YourGuruDB" connectionString="Data Source=DIMA-00AA1DA557;Initial Catalog=model;Integrated Security=True"/>
        <add name="modelConnectionString" connectionString="Data Source=DIMA-00AA1DA557;Initial Catalog=model;Integrated Security=True" providerName="System.Data.SqlClient"/>
        <add name="LocalSqlServer2" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename='D:\Documents and Settings\Dima\My Documents\Visual Studio 2010\WebSites\WebSite10\App_Data\ASPNETDB.MDF';Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient"/>


  </connectionStrings>
  <system.web>



    <membership defaultProvider="MyMembershipProvider">
      <providers>
        <clear/>
        <add
          name="MyMembershipProvider"
          type="System.Web.Security.SqlMembershipProvider"
          connectionStringName="LocalSqlServer2"
          minRequiredPasswordLength="2"
          minRequiredNonalphanumericCharacters="0"
          maxInvalidPasswordAttempts="1000"
          passwordAttemptWindow="1000"
          />
      </providers>
    </membership>

    <roleManager enabled="true" />

    <authentication mode="Forms">
        <forms name="MyAppCookie"
             loginUrl="~/Registration.aspx"
             protection="All"
             timeout="30" path="/" />
    </authentication>

2 个答案:

答案 0 :(得分:4)

“LocalSqlServer”是否作为连接字符串存在? 你得到了什么错误?

你应该在你的ConnectionString部分找到类似的东西:

 <add name="LocalSqlServer" connectionString="<YourConnectionString>" providerName="System.Data.SqlClient"/>

你启用了FormsAuthentication吗?

  <authentication mode="Forms">
     <forms loginUrl="<YourLoginPage>" timeout="2880"/>
   </authentication>

答案 1 :(得分:0)

您是否正在重设密码或通过电子邮件发送实际密码? 您是否检查过会员表以确保您没有被锁定?

我可以看到你有maxInvalidPasswordAttempts="1000"但是如果你一直在玩配置,那么你可能会在更改设置之前锁定自己。