简体   繁体   中英

ASP.NET MVC Authentication Redirect to Login Page when user route to the critical area

I have an intranet application using windows authentication that works great. Now I have a requirement to expose an Admin area. This area should go to login page and get user password again.

Like when you are already logged into your Google account or your Facebook account and you need to re-enter your password when routing to a critical area.

This is an example of my application structure:

-IntranetApp
--Controllers
--Admin Areas
----Area1
----Area2
--Special Users Area
----Area1
----Area2

Thank you very much indeed for any help/pointers. Now, I want to develop the mentioned code to my App using Asp.net MVC3?

Additional information:

Here are a few examples:
When you are already logged into your Google account and you want to delete your account for security reasons Google asks you to re-enter your password.
Please log into your Google account, then go to Edit 2-step Verification

Would you mind helping me with this, please?

What about using Roles?

eg

[Authorize(Roles="admin")]
public ActionResult Create() {
...
}

Guru Gu has a good post about it , from the NerdDinner application.

In Asp.net MVC applications which use SQL Authentication via asp.net membership provider you can set the authentication for any controller or action by decorating it with Authorize attribute as Pure.Krome explained.

But for Creating an Intranet Site Using ASP.NET MVC, I would suggest to follow this MSDN article . It's a nice article explaining utilizing windows authentication

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM