2011-05-25 63 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