Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Restrict users from using admin section in asp.net mvc

I am using membership in asp.net mvc 2 and i want to restrict users from using the admin section , Currently all the users can access the admin section by using their credentials, I used [Authorise] for all the http get and post request for that , but how can restrict everyone apart from admin & some users with certain privileges , I have got table in db asp_net Roles which have 2 role names : Admin and user.

like image 585
Mr A Avatar asked Jan 19 '26 20:01

Mr A


1 Answers

You can do this ...

[Authorize(Roles = "Admin")]
like image 66
dknaack Avatar answered Jan 21 '26 12:01

dknaack