Sam
Sam

Reputation: 15770

Forms Authentication with Multiple MVC Areas

I have a simple task to accomplish, I am creating an application that has two types of users, Admins and Users.

I looked at this: ASP.NET MVC 3 Areas and multiple authentication in web.config

And it is very close to what I need to do.

So the simple question is how do you have different login schemes using Forms Authentication in different areas on an MVC site?

Upvotes: 2

Views: 3921

Answers (1)

Chintana Meegamarachchi
Chintana Meegamarachchi

Reputation: 1820

putting security attributes in web.config many not be the best thing to do as explained by the post How can we set authorization for a whole area in ASP.NET MVC?. Please consider applying attributes at the controller level eg

[Authorize(Roles = "User, Administrator")]

or

[Authorize(Roles = "User")]

or

[Authorize(Roles = "User, Administrator")]

Happy Coding

Upvotes: 3

Related Questions