How to create a custom role provider
I want to create a custom role provider which returns the role data based on username and other additional parameters. Currently although I am able to override RoleProvider class I am unable to pass additonal parameters to the default GetRolesForUsers method.
Re: How to create a custom role provider
The web.config file will need several new pieces. In order to glue the Login control to your custom membership provider, you will need a section called <membership>. You can set the properties of the custom provider in this section. You can also control these properties from the custom membership provider class. The web.config used for this ,assumes some aspx files should be accessible only after login is validated, and some files should always be available.
<authentication mode="Forms">
<forms name="sqlAuthCookie" loginUrl="~/Login.aspx" protection="All" timeout="120" defaultUrl="~/MainMenu.aspx"/>
</authentication>
<machineKey validationKey="C50B3C89CB21F4F1422FF158A5B42D0E8DB8CB5CDA1742572A487D9401E3400267682B202B746511891C1BAF47F8D25C07F6C39A104696DB51F17C529AD3CABE" decryptionKey="8A9BE8FD67AF6979E7D20198CFEA50DD3D3799C77AF2B72F" validation="SHA1"/>
<authorization>
<allow roles="admin"/>
<allow roles="guest"/>
<deny users="?"/>
<allow users="*"/>
</authorization>
<!--Testing For Role Based Auth-->
<!--The following section defines the pages which required role based authorisation-->
<location path="Default1.aspx">
<system.web>
<authorization>
<allow roles="group_custsrv_manager"/>
<allow roles="group_personnel_manager"/>
<allow roles="GROUP_STORE_MANAGER"/>
<allow roles="group_support_team"/>
<allow roles="group_system_clerk"/>
<allow roles="GROUP_TRADING_MANAGER"/>
<deny roles="GROUP_CHECKOUT_CONTROLLER"/>
<deny roles="GROUP_FRESHSECT_MANAGER"/>
<deny roles="GROUP_STAFF_TRAINER"/>
<deny roles="GROUP_SYSTEMS_MANAGER"/>
</authorization>
</system.web>
</location>
Re: How to create a custom role provider
In asp.net its very easy, Please follow the steps and you can create your own roles:
Open you web site In standard bar there is tab for 'Website' -> got o Asp.net Configuration thats open a new web page then follow the guidelines as there mention you can create roles.