Customizing authorization in ASP.NET MVC
问题 My Controller class is decorated with an AuthorizeAttribute to protect the actions: [Authorize(Roles = \"User Level 2\")] public class BuyController : Controller { ... } Anytime an action is invoked but the user is not in at least the role \"User Level 2\" he is automatically redirected to the login page with a url like this: http://localhost:1436/Account/Login?ReturnUrl=%2fBuy If the user is already logged in, but doesn\'t have the right security level, this is not an optimal behavior! It