In ASP.NET forum very often a question is asked. How to set Roles and accordingly restrict access to certain pages?
There are definitely various ways. But I prefer UserControl. Its advantage is you can drag it to the Masterpage and its functionality has been used all along your application.
Here the main problem is I can’t use the code so I upload codes as Images part by part.
Here is the code:
Here I used few controls like LoginView, LogInStatus and lastly in the Page_Load event handler I checked whether User.Identity.IsAuthenticated. It can be used as User.IsInRole also to check the user belongs to a certain Role or not.
In this way, one can check whether a user belongs to the Role Administrator or Member, if he/she is Administrator can go to CatalogAdmin.aspx and if he/she belongs to the Role of Member, then he/she might have access to Member_1.aspx page.