Search code examples
c#asp.netroleprovider

The Role Manager feature has not been enabled


Got the following ProviderException :

The Role Manager feature has not been enabled.

So far so good.

Is there somewhere a method that can be called to check if the Role Manager has been enabled or not?


Solution

  • You can do this by reading from the boolean property at:

    System.Web.Security.Roles.Enabled
    

    This is a direct read from the enabled attribute of the roleManager element in the web.config:

    <configuration>
      <system.web>
        <roleManager enabled="true" />
      </system.web>
    </configuration>
    


    Update:
    For more information, check out this MSDN sample: https://msdn.microsoft.com/en-us/library/aa354509(v=vs.110).aspx