2
Answers

Role Manager feature has not been enabled (Identity)

Dealy

Dealy

8y
2k
1
Hello,
 
I'm using webforms and I'm trying to add users to roles using the following code:
  1. Roles.AddUserToRole(userTxt.Text, roleTxt.Text);  
At first, I was getting the message "The Role Manager feature has not been enabled."
 
So, I added these lines to web.config of the Admin role
  1. <?xml version="1.0"?>  
  2.   
  3. <configuration>   
  4.   <system.web>  
  5.     <roleManager  
  6.         enabled="true"  
  7.         cacheRolesInCookie="true" >  
  8.     </roleManager>  
  9.     <authorization>  
  10.       <allow roles="Administrator"/>  
  11.       <deny users="*"/>  
  12.     </authorization>  
  13.   </system.web>  
  14. </configuration>  
 Now, I get this parser error message "Parser Error Message: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS."
 
I would appreciate any kind of help, thank you in advance. 
 
Answers (2)