如何在asp.net中更改默认成员资格提供程序值

时间:2014-07-25 12:13:48

标签: asp.net asp.net-membership membership-provider membership static-members

我在web.config中声明了多个成员资格提供程序

<membership userIsOnlineTimeWindow="15" defaultProvider="UmbracoMembershipProvider">
  <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="/"  />
    <add name="UmbracoMembershipProvider" type="umbraco.providers.members.UmbracoMembershipProvider" enablePasswordRetrieval="false" enablePasswordReset="false" requiresQuestionAndAnswer="false" defaultMemberTypeAlias="Another Type" passwordFormat="Hashed" />        
    <add name="Reset_Pass" connectionStringName="AspNetDB" applicationName="/" enablePasswordReset="true" enablePasswordRetrieval="false" maxInvalidPasswordAttempts="100000" minRequiredPasswordLength="5" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="100000" passwordStrengthRegularExpression="" passwordFormat="Hashed" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" type="SiteMemberShipProvider" />
  </providers>
</membership>

但是当我跟注时,会员资格被分配默认提供商的价值。

public static MembershipUser GetUserInfoByUserName(string username)
        {
            MembershipUser user = Membership.GetUser(username);
            return user;
        }

当我监视Membership值的值时,它设置defaultProvider的值

enter image description here

如何将成员资格提供程序值更改为“AspNetSqlMembershipProvider”。

0 个答案:

没有答案