У меня есть собственный класс членства asp.net, который я создаю, где у меня есть вспомогательная функция, которую метод GetUser () использует для преобразования значений из моей базы данных в объект System.Web.Security.MembershipUser.
private MembershipUser _converToMembershipUser(MembershipDBModel member)
{
System.Web.Security.MembershipUser membershipUser = new System.Web.Security.MembershipUser(
this.Name,
member.UserName,
member.UserID.ToString(),
member.Email,
member.PasswordQuestion,
member.Comment,
member.IsApproved,
member.IsLockedOut,
member.CreationDate,
member.LastLoginDate,
member.LastActivityDate,
member.LastPasswordChangedDate,
member.LastLockedOutDate);
return membershipUser;
}
Это ошибка, которую я продолжаю получать при вызове вышеуказанного метода.Я понятия не имею, как обойти это, поэтому любые предложения очень приветствуются.
System.IO.FileLoadException was caught
Message=The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)
Source=System.Web
StackTrace:
at System.Web.Security.Membership.Initialize()
at System.Web.Security.MembershipAdapter.get_Providers()
at System.Web.Security.MembershipUser..ctor(String providerName, String name, Object providerUserKey, String email, String passwordQuestion, String comment, Boolean isApproved, Boolean isLockedOut, DateTime creationDate, DateTime lastLoginDate, DateTime lastActivityDate, DateTime lastPasswordChangedDate, DateTime lastLockoutDate)
at TMTechMembershipProvider.MembershipProvider._converToMembershipUser(MembershipDBModel member) in d:\Visual Studio 2010\Projects\TMTechMembershipProvider\TMTechMembershipProvider\TMTechMembershipProvider.cs:line 1005
at TMTechMembershipProvider.MembershipProvider.GetUser(String username) in d:\Visual Studio 2010\Projects\TMTechMembershipProvider\TMTechMembershipProvider\TMTechMembershipProvider.cs:line 965
at TMTechMembershipProvider.MembershipProvider.CreateUser(String username, String password, String email, String passwordQuestion, String passwordAnswer, Boolean isApproved, Object providerUserKey, MembershipCreateStatus& status) in d:\Visual Studio 2010\Projects\TMTechMembershipProvider\TMTechMembershipProvider\TMTechMembershipProvider.cs:line 435
InnerException:
System.Web.Security.MembershipAdapter.get_Providers() Initialize() The given assembly name or codebase was invalid.
файл конфигурации
<?xml version="1.0"?>
<configuration>
<appSettings></appSettings>
<connectionStrings>
<add name="MembershipDBContext" providerName="System.Data.SqlServerCe.4.0" connectionString="data source=MembershipDBContext.sdf"/>
</connectionStrings>
<system.web>
<membership>
<providers>
<!--<remove name="AspNetSqlMembershipProvider"/>
<add name="AspNetSqlMembershipProvider" type="TMTechMembershipProvider, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cbae438f5bab0724" connectionStringName="MembershipDBContext" enablePasswordRetrieval="true" enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="MyUnitTests" requiresUniqueEmail="true" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10" passwordStrengthRegularExpression=""/>-->
<clear/>
<!--<add name="TMTechMembershipProvider.MembershipProvider" type="TMTechMembershipProvider, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cbae438f5bab0724" connectionStringName="MembershipDBContext" enablePasswordRetrieval="true" enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="MyUnitTests" requiresUniqueEmail="true" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10" passwordStrengthRegularExpression=""/>-->
<add name="TMTechMembershipProvider"
type="TMTechMembershipProvider.TempMembershipProvider"
connectionStringName="MembershipDBContext"
enablePasswordRetrieval="true"
enablePasswordReset="true"
requiresQuestionAndAnswer="true"
applicationName="MyUnitTests"
requiresUniqueEmail="true"
passwordFormat="Hashed"
maxInvalidPasswordAttempts="5"
minRequiredPasswordLength="6"
minRequiredNonalphanumericCharacters="1"
passwordAttemptWindow="10"
passwordStrengthRegularExpression=""/>
</providers>
</membership>
<machineKey validationKey="EAA358B778400490DE16A414AC2144C740874D426214CA81D8265354535ACCA9C0238D5C20021D4335DBE1171F31C02F0AB8ADD5B1EE2A6E07CC768F04B20F30" decryptionKey="AF622C5C9796D67DEB876483F1341E3708CA056B1EB031CEAD6FD7CBD0F13A50" validation="SHA1" decryption="AES"/>
</system.web>
<!--<system.web>
<membership>
<providers>
<remove name="AspNetSqlMembershipProvider"/>
<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="false"
applicationName="/"
requiresUniqueEmail="false"
passwordFormat="Hashed"
maxInvalidPasswordAttempts="5"
minRequiredPasswordLength="1"
minRequiredNonalphanumericCharacters="0"
passwordAttemptWindow="10"
passwordStrengthRegularExpression="" />
</providers>
</membership>
</system.web>-->
<startup>
<!--<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>-->
</startup>
</configuration>