简体   繁体   English

ASP.Net Web应用程序安全性不适用于IIS 7?

[英]ASP.Net Web Application Security dont work on IIS 7?

i am facing a wierd problem 我面临着一个奇怪的问题

i use visual studio 2010, SQL express 2008 on win server 2008 我在win server 2008上使用visual studio 2010,SQL Express 2008

after running the wizard of security (created single user, set permissions like deny anonymous and allow the created user) and pressing F5 --> the site works just fine. 在运行安全向导(创建单个用户,设置权限,如拒绝匿名并允许创建的用户)并按F5 - >该网站工作正常。

when i move the folder to IIS 7 and "convert to application" the login page appears but it wont accept the password i provided. 当我将文件夹移动到IIS 7并“转换为应用程序”时,会出现登录页面,但它不会接受我提供的密码。

i was told that only Stackoverflow geniuses will answer this question. 有人告诉我,只有Stackoverflow天才会回答这个问题。

i am using .Net 4, manged pipleine mode --> inegrated 我正在使用.Net 4,manged pipleine模式 - > inegrated

IIS settings: IIS设置:

Anonymous Auth. 匿名认证 --> Enabled - >启用

Forms Auth. 表格认证。 --> Enabled - >启用

ASP.Net Impersonation, Basic Auth, Digest Auth, Windows Auth--> Disabled ASP.Net模拟,基本身份验证,摘要身份验证,Windows身份验证 - >已禁用

web.config 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>

the username exists in aspnet_Users table and the username "encrypted" in aspnet_Membership table 用户名存在于aspnet_Users表中,用户名“加密”在aspnet_Membership表中

Read the article 阅读文章

Always set the "applicationName" property when configuring ASP.NET 2.0 Membership and other Providers 配置ASP.NET 2.0成员身份和其他提供程序时始终设置“applicationName”属性

try creating a new website and put the application component in the root in case web.config application name = "/" 尝试创建一个新网站,并将应用程序组件放在root中,万一web.config application name =“/”

i hope this will solve it 我希望这能解决它

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM