I am using asp.net forms authentication, membership provider and role provider.
You can refer to this post.
This post helped me to restrict access of the users to the specific areas of Web application according to their roles.
But the roles are hard-coded in the Web.config file.
I need to read the roles from the asp.net role provider database.
I want to use the database generated by this command:
[C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727>aspnet_regsql]
and the following tool:

and [aspnetdb] database.
And I want to use microsoft’s framework and avoid my own customization as far as possible.
Plz tell me how can I generate authentication and authorization ticket. Better if you can show me some C# code.
Can anyone help me?
If you have already wired Authentication and Membership using SQL Server in your site it will be easy for you. Just follow these steps:
Create role store on sql server
Add connection string for role provider:
Add role manager:
Now you can use Role based stuff in your pages (supposing you have already enabled authentication [windows or forms])
Test ASPX:
Codebehind:
Simillarly you can use
Role.IsUserInRole("ROLE_NAME")to check if user is assigned particular role.