Like the title said there is an error with the roleManager
here's the web.config code:
<roleManager enabled="true" defaultProvider="MyProvider">
<providers>
<add name="MyProvider" type="TrollMarket.web.MyRoleProvider.RoleSite"/>
</providers>
</roleManager>
here's GetRoleForUser
public override string[] GetRolesForUser(string username) {
AccountProvider accountProvider = new AccountProvider();
string role = accountProvider.GetRole(username);
string[] result = { role };
return result;
}
here is the getrole function
public string GetRole(string username) {
var user = trollContext.Account.FirstOrDefault(acc => acc.username == username);
return user.role;
}
please taught me how to fix it this is an assignment from my senior and with This error i couldn't get the role
this is the error
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>
Nevermind i found the answer, for those who has the same problem check your provider namespace and change the type depending on the namespace like this
<add name="MyProvider" type="namespace.MyRoleProvider.RoleSite"/>