就像标题所说的roleManager有错误
这是 web.config 代码:
<roleManager enabled="true" defaultProvider="MyProvider">
<providers>
<add name="MyProvider" type="TrollMarket.web.MyRoleProvider.RoleSite"/>
</providers>
</roleManager>
这是 GetRoleForUser
public override string[] GetRolesForUser(string username) {
AccountProvider accountProvider = new AccountProvider();
string role = accountProvider.GetRole(username);
string[] result = { role };
return result;
}
这是getrole函数
public string GetRole(string username) {
var user = trollContext.Account.FirstOrDefault(acc => acc.username == username);
return user.role;
}
请教我如何解决它这是我的前辈的一项任务,由于这个错误我无法获得这个角色
这是错误
Configuration Error
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 type 'TrollMarket.web.MyRoleProvider.RoleSite'.
Source Error:
Line 26: <roleManager enabled="true" defaultProvider="MyProvider">
Line 27: <providers>
Line 28: <add name="MyProvider" type="TrollMarket.web.MyRoleProvider.RoleSite"/>
Line 29: </providers>
Line 30: </roleManager>