C# membership multiple providers createuser 错误
C# membership multiple providers createuser error
我声明了 2 个会员提供商:
<membership defaultProvider="AspNetSqlMembershipProvider">
<providers>
<clear/>
<add connectionStringName="ConnectionString1" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" passwordFormat="Hashed" minRequiredNonalphanumericCharacters="2" minRequiredPasswordLength="8" maxInvalidPasswordAttempts="5" passwordAttemptWindow="30" applicationName="/" name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web,Version=2.0.0.0, Culture=neutral, PublicKeyToken=xzxzxz"/>
<add connectionStringName="ConnectionString2" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" passwordFormat="Hashed" minRequiredNonalphanumericCharacters="2" minRequiredPasswordLength="8" maxInvalidPasswordAttempts="5" passwordAttemptWindow="30" applicationName="/" name="AspNetSqlMembershipProviderProduction" type="System.Web.Security.SqlMembershipProvider, System.Web,Version=2.0.0.0, Culture=neutral, PublicKeyToken=xxxx"/>
</providers>
</membership>
但是当我使用其中一个提供商调用 CreateUser 时:
var membershipProviderProduction = Membership.Providers["AspNetSqlMembershipProviderProduction"];
MembershipUser newUser = membershipProviderProduction.CreateUser(username, password, email, question, answer, isAproved, out cs);
我收到这个错误:
Error 65 No overload for method 'CreateUser' takes 7 arguments
好吧,据我所知它有 8 个参数检查下面
MembershipUser CreateUser(string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey, out MembershipCreateStatus status);
你错过了 'providerUserKey' 事实上
我声明了 2 个会员提供商:
<membership defaultProvider="AspNetSqlMembershipProvider">
<providers>
<clear/>
<add connectionStringName="ConnectionString1" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" passwordFormat="Hashed" minRequiredNonalphanumericCharacters="2" minRequiredPasswordLength="8" maxInvalidPasswordAttempts="5" passwordAttemptWindow="30" applicationName="/" name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web,Version=2.0.0.0, Culture=neutral, PublicKeyToken=xzxzxz"/>
<add connectionStringName="ConnectionString2" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" passwordFormat="Hashed" minRequiredNonalphanumericCharacters="2" minRequiredPasswordLength="8" maxInvalidPasswordAttempts="5" passwordAttemptWindow="30" applicationName="/" name="AspNetSqlMembershipProviderProduction" type="System.Web.Security.SqlMembershipProvider, System.Web,Version=2.0.0.0, Culture=neutral, PublicKeyToken=xxxx"/>
</providers>
</membership>
但是当我使用其中一个提供商调用 CreateUser 时:
var membershipProviderProduction = Membership.Providers["AspNetSqlMembershipProviderProduction"];
MembershipUser newUser = membershipProviderProduction.CreateUser(username, password, email, question, answer, isAproved, out cs);
我收到这个错误:
Error 65 No overload for method 'CreateUser' takes 7 arguments
好吧,据我所知它有 8 个参数检查下面
MembershipUser CreateUser(string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey, out MembershipCreateStatus status);
你错过了 'providerUserKey' 事实上