Click here to Skip to main content
15,891,863 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am developing a website
it has two roles admin and user

if user login into the website , i want restrict some pages,
if admin login no restrictions

am identifying admin from registration table with name
Posted
Comments
Mangal Deep Gupta 6-Jan-16 4:54am    
you can try this

http://www.c-sharpcorner.com/UploadFile/praveenalwar/praveenalwar08082006090541AM/praveenalwar.aspx

1 solution

All you have to do is check if the logged-in user belong to the role name.
Am assuming you have two roles as "admin" and "user"

VB
Protected Page_Load()
If My.User.IsAuthenticated Then
If Not My.User.IsInRole("admin") Then
Response.Redirect("~/")
End If
End If
End Sub


Try it out and add a feedback
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900