2011-05-25 115 views
1

我把一个登录控制,它不会让我在网站内。 (我甚至试图使用登录控制检索和重置密码,仍然不会工作)。asp.net登录控制不起作用

这是我的web.config文件的一部分。昨天,我通过更改添加标签中的属性来解决该问题..但今天,问题重演。

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> 
+1

小心你的话,当我读到你的标题时,我想到了鸡小鸡,在他宣布“天空正在下降”之后,恐慌随之而来......你的配置出了问题......什么错误?你的连接字符串是否正确? – Nix 2011-05-25 15:09:36

+1

你会得到什么错误? – 2011-05-25 15:09:41

+0

我没有得到任何错误,我得到的是,失败登录,每次我尝试通过登录控制登录。但我能够检索密码。不要登录!!我认为配置文件中的一个属性阻止我接受密码。 – 2011-05-25 15:13:31

回答

4

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

你会发现在你的ConnectionString部分是这样的:

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

,也启用了FormsAuthentication?

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

2011-05-25 15:21:58

+0

由于您更新了问题,此答案看起来正确。连接字符串名称是错误的。 – 2011-05-25 15:23:39

+0

连接字符串名称有什么问题?为什么当我打开我的服务器浏览器时,我在dabase图标附近看到红色的Xes? – 2011-05-25 15:25:21

0

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

我可以看到你有maxInvalidPasswordAttempts="1000"但是如果你一直在玩配置,也许你在改变设置之前自己锁定了。

+0

不,我正在检索它与事件,我避免它被发送到电子邮件。我不锁定自己,我检查了数据库。锁定是错误的。 – 2011-05-25 15:18:28