2009-08-19 2 views
2

CreateUserWizard 컨트롤을 사용하여 사용자를 만들었습니다. 다음과 같이ASP.NET FormsAuthentication.Authenticate()가 작동하지 않습니다.

web.config 파일은 다음과 같습니다 나는 그것을 발견하고

<?xml version="1.0"?> 

<configuration> 

    <appSettings/> 

    <connectionStrings> 
    <remove name="LocalSqlServer"/> 
    <add name="ConnString1" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=IceWebPortal_SQL2K5;user=sa;password=;integrated security=true;" providerName="System.Data.SqlClient"/> 
    <add name="LocalSqlServer" connectionString="Data Source=localhost;Initial Catalog=aspnet_membership_test;Integrated Security=True" providerName="System.Data.SqlClient"/> 
    </connectionStrings> 

    <system.web> 
     <!-- 
      Set compilation debug="true" to insert debugging 
      symbols into the compiled page. Because this 
      affects performance, set this value to true only 
      during development. 
     --> 
     <compilation debug="true" /> 
     <!-- 
      The <authentication> section enables configuration 
      of the security authentication mode used by 
      ASP.NET to identify an incoming user. 
     --> 
    <authentication mode="Forms"> 
     <forms 
     name="CookieDemo" 
     loginUrl="Default.aspx" 
     protection="All" 
     timeout="30" 
     path="/" 
     /> 
    </authentication> 
    <!--<authorization> 
     <deny users="?"/> 
    </authorization>--> 
    </system.web> 

    <location path="Default.aspx"> 
    <system.web> 
     <authorization> 
     <allow users="*"></allow> 
     </authorization> 
    </system.web> 
    </location> 
</configuration> 

, FormsAuthentication.Authenticate(username, password);는 항상 false를 반환합니다.

string username = this.usernameTextBox.Text; 
string password = this.passwordTextBox.Text; 

bool success = FormsAuthentication.Authenticate(username, password); 

if (success) 
{ 
} 

무엇이 문제 일 수 있습니까?

답변

3

예를 들면 다음과 같습니다.

<membership> 
    <providers> 
     <clear /> 
     <add name="AspNetSqlMembershipProvider" 
      type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" 
      connectionStringName="ApplicationServices" 
      enablePasswordRetrieval="false" 
      enablePasswordReset="true" 
      requiresQuestionAndAnswer="false" 
      requiresUniqueEmail="false" 
      passwordFormat="Hashed" 
      maxInvalidPasswordAttempts="5" 
      minRequiredPasswordLength="6" 
      minRequiredNonalphanumericCharacters="0" 
      passwordAttemptWindow="10" 
      passwordStrengthRegularExpression="" 
      applicationName="/" /> 
    </providers> 
</membership> 
:

예 - MembershipProvider configuration 또는 (아마 좋은 생각이 아니다있는) 직접의 Web.config에 사용자를 추가

관련 문제