Skip to content

Role Manager feature has not been enabled (Identity)

Dealy

Asked Aug 4, 2016, 2:50 AM EDT2 answers
Share
LinkedInX
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. 

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • Suthish Nair
    +1
    Are you using any member ship provider or default provider?
    +1
  • 1 short reply
    • +1
      default provider
      +1