Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Role Management Providers Configuration:

    • 0
    • 1
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 101
    Comment on it

    Role Management Providers Configuration:

    Role management providers are used by the role management services in order to separate the functionality of role management from the data store that contains the role information, however roles can use the same database that we use for membership services and the user profile.

    Following are the Role Providers provided by .Net Framework on the basis of maintaining different data stores:

    1.SQL Server- this is the default provider,role information is stored in a SQL Server database.

    2.Windows Token - this is useful only if the application runs on a network where all users have domain accounts.

    3.Authorization Manager- in this the role information is managed using an Authorization Manager XML file.

    Usually we configure the role management in our application's Web.config file which is convenient for smaller web applications.

    For Example:

    <roleManager enabled="true" cacheRolesInCookie="true" 
        cookieName="TBHROLES" defaultProvider="Demo&#95;RoleProvider">
       <providers>
        <add connectionStringName="dld&#95;connectionstring"
         applicationName="/" name="Demo&#95;RoleProvider"
         type="System.Web.Security.SqlRoleProvider, System.Web,
         Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
       </providers>
    </roleManager>
    

    During configuring the role management we specify the provider by setting the defaultProvider attribute.

    For Example: If we want to specify the role provider with the name "SQL", then:

    <roleManager 
       defaultProvider="SQL"
    enabled="true" 
       cacheRolesInCookie="true" >
    </roleManager>
    

    If we want to use WindowsToken Role Provider then we have to make the following entry in the web.config file.

    <authentication mode="Windows" />
    

    Note: This will allow the application to use Windows authentication.

    Customizing Role Management Provider:

    We can also create a custom role management provider for our application, in which we can define our own storage for role information or use an existing role-information store.We can do this by creating a class that inherits the RoleProvider abstract class as the RoleProvider class identifies the methods that the provider defines.Now we have our custom role provider so we have to configure our application again as we did above in the case of "SQL" Role Provider.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: