Reputation: 778
I am working on a small MVC application and now I want to implement an admin section on the website, so that only admin users can access that page/section. I currently have form authentication login.
I followed a tutorial (http://msdn.microsoft.com/en-us/library/t32yf0a9.aspx) regarding Role Provider in MVC and how it can ristrict and do all these stuff using the wizard for role provider, how you can create users.
My question is those users i setup for admin/non admin using the role provider wizard, will they be the users i would authenticate to access the application? i currently have authentication that check users against the database
Thanks in advance
Upvotes: 0
Views: 3089
Reputation: 13003
I would suggest you to simply "google" about this issue.
Look how it's easy:
Basically, there is the AuthorizeAttribute
out there which you should use and supply with your authorized users:
[Authorize("Kayze")]
public ActionResults Employees()
{
//Your code
}
Now notice that "Kayze" user will be validated against the source (DB, Active-Directory, file etc.) which your Role Provider is based on.
The users authorization and authentication is depends on your Role-Provider, please read this article about how to configure it: http://odetocode.com/articles/427.aspx
Upvotes: 1