web.config中試試這個:錯誤與會員AD提供商
<configuration>
<connectionStrings>
<add name="ADService" connectionString="LDAP://mossdc02/, dc=expgroup, dc=ru" />
</connectionStrings>
<system.web>
<membership defaultProvider="AspNetActiveDirectoryMembershipProvider">
<providers>
<add name="AspNetActiveDirectoryMembershipProvider"
type="System.Web.Security.ActiveDirectoryMembershipProvider,
System.Web, Version=2.0.3600, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a"
connectionStringName="ADService"
connectionUsername="domain\\userName"
connectionPassword="password"/>
</providers>
</membership>
<compilation debug="true" targetFramework="4.0"/>
<httpRuntime/>
<authentication mode="Windows" />
</system.web>
</configuration>
在cs文件火這樣的:
protected void Login1_Authenticate(object sender, AuthenticateEventArgs e) {
string userName = "domain\\userName";
string password = "password";
if (Membership.Providers["AspNetActiveDirectoryMembershipProvider"].ValidateUser(userName, password)) {
e.Authenticated = true;
}
}
有此錯誤:
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Could not load file or assembly 'System.Web, Version=2.0.3600, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
Source Error:
Line 12: Line 13: type="System.Web.Security.ActiveDirectoryMembershipProvider, Line 15: System.Web, Version=2.0.3600, Culture=neutral, Line 16:
PublicKeyToken=b03f5f7f11d50a3a"
請幫助。 )
不明白。此代碼與我的代碼類似。 – mathewsun
版本應該是2.0.0.0,但不是2.0.3600。好。謝謝! – mathewsun
我的實際懷疑是正確的關於GAC :) –