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

这是我的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>

最佳答案

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

您应该在ConnectionString部分中找到类似以下内容的内容:

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


您是否启用了FormsAuthentication?

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

关于c# - asp.net登录控件不起作用,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/6126658/

10-13 08:11