简体   繁体   English

ASP.NET成员资格提供程序在数据库中生成两个应用程序

[英]ASP.NET membership provider generates two applications in the database

I am using the below defined membership provider web config settings. 我正在使用以下定义的成员资格提供程序Web配置设置。 when I access my admin pages to start to add roles and users to the system generated SQL Server tables I see two applications created. 当我访问管理页面以开始向系统生成的SQL Server表添加角色和用户时,我看到创建了两个应用程序。 one with a application name of "/" and the second is called what my setting is configured to PolyWebSite . 一个使用应用程序名称“ /”,第二个称为我的设置配置为PolyWebSite

My steps are: 我的步骤是:

  1. as an unauthenticated user I browse to role config page to add admin and other roles. 作为未经身份验证的用户,我浏览到角色配置页面以添加管理员和其他角色。 this is when the first application is created. 这是创建第一个应用程序的时间。

  2. I browse to a custom user page where I add users and assign them roles. 我浏览到一个自定义用户页面,在其中添加用户并为其分配角色。 also as an unauthenticated user. 也作为未经身份验证的用户。 this is when a second application is created with the name PolyWebSite as set in my web.config 这是在我的web.config设置的名称为PolyWebSite的第二个应用程序创建时

     <roleManager enabled="true" /> <membership defaultProvider="AspNetSql2005MembershipProvider"> <providers> <add name="AspNetSql2005MembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0" connectionStringName="SqlConnString" enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="PolyWebSite" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="1" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" passwordStrengthRegularExpression="" passwordFormat="Clear"/> </providers> </membership> 

figured it out: added details to the roleManager part of the web.config to be in sync with membership section. 弄清楚了:将详细信息添加到web.config的roleManager部分,以便与成员资格部分同步。 items added were connectionStringName and applicationName. 添加的项目为connectionStringName和applicationName。

   <membership defaultProvider="AspNetSql2005MembershipProvider">
      <providers>
        <add name="AspNetSql2005MembershipProvider" 
             type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" 
             connectionStringName="SqlConnString" 
             enablePasswordReset="true" 
             requiresQuestionAndAnswer="true" 
             applicationName="PolyWebSite" 
             requiresUniqueEmail="true" 
             maxInvalidPasswordAttempts="5" 
             minRequiredPasswordLength="1" 
             minRequiredNonalphanumericCharacters="0" 
             passwordAttemptWindow="10" 
             passwordStrengthRegularExpression=""
             passwordFormat="Clear"/>
      </providers>
    </membership>


    <roleManager enabled ="true" defaultProvider ="SqlRoleProvider" >
      <providers>
        <add name ="SqlRoleProvider"
          type="System.Web.Security.SqlRoleProvider"
          connectionStringName="SqlConnString"
          applicationName="PolyWebSite"/>
      </providers>
    </roleManager>

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

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