简体   繁体   中英

Authentication from Asp.Net 2.0 to Asp.Net 4.0

We have an existing application written in asp.net 2.0. Then we created a new module using mvc3 which is obviously asp.net 4.0. Is there someone who tried having authentication from 2.0 submitted to the mvc3 site to be able to access the mvc3 page? Thanks!

Look at the following link: asp.net mvc Adding to the AUTHORIZE attribute

It should answer your question.

Basically you have to create an attribute class derived from AuthorizeAttribute

And then you can use this attribute with your controller class like:

[YourAuthorization(Roles = "Admin", ViewName="AccessDenied")]
public class YourControllerController : Controller

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