2011-01-20 72 views
5

我面臨的一個奇怪的問題ASP.Net Web應用程序安全不工作在IIS 7上?

我使用Visual Studio 2010,SQL贏服務器2008

上表示2008年運行安全向導(創建一個用戶後,設置權限一樣拒絕匿名,並允許創建的用戶)並按下F5 - >該網站工作得很好。

當我將文件夾移動到IIS 7和「轉換爲應用程序」的登錄頁面出現,但它不會接受我提供的密碼。

我被告知只有Stackoverflow天才會回答這個問題。

我使用的.Net 4,manged pipleine模式 - > inegrated

IIS設置:

匿名驗證。 - > Enabled

Forms Auth。 - >已啓用

ASP.Net模擬,基本身份驗證,摘要驗證,Windows驗證 - >禁用

的web.config

<configuration> 
    <connectionStrings> 
    <add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated  Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient"/> 
    </connectionStrings> 
    <system.web> 
    <authorization> 
     <deny users="?"/> 
     <allow users="statmaster"/> 
    </authorization> 
    <compilation debug="true" strict="false" explicit="true" targetFramework="4.0"/> 
    <authentication mode="Forms"> 
     <forms loginUrl="~/Account/Login.aspx" timeout="2880"/> 
    </authentication> 

    <membership> 
     <providers> 
     <clear/> 
     <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices"  enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/"/> 
     </providers> 
    </membership> 

    <profile> 
     <providers>  
     <clear/>  
     <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/"/> 
     </providers> 
    </profile> 
    <roleManager enabled="false"> 
     <providers> 
     <clear/> 
     <add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider"  connectionStringName="ApplicationServices" applicationName="/"/> 

     <add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/"/> 
     </providers> 
    </roleManager> 
    </system.web> 

    <system.webServer> 
    <modules runAllManagedModulesForAllRequests="true"/> 
    </system.webServer> 

</configuration> 

的用戶名在aspnet_Users表格內和用戶名存在在aspnet_Membership表

+0

什麼驗證你有虛擬目錄設置?你在web.config中指定了哪些認證? – slugster 2011-01-20 08:23:55

回答

4

「加密」 閱讀文章

Always set the "applicationName" property when configuring ASP.NET 2.0 Membership and other Providers

嘗試創建一個新的網站,並把應用程序組件的根在web.config中的情況下應用程序的名稱=「/」

我希望這將解決這個問題

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

http://weblogs.asp.net/scottgu/archive/2006/04/22/Always-set-the-_2200_applicationName_2200_-property-when-configuring-ASP.NET-2.0-Membership-and-other-Providers.aspx

相關問題