ASP.Net MVC 3 Redirect UnAuthorized User not to loginUrl

前端 未结 6 1593
庸人自扰
庸人自扰 2020-12-23 22:40

i have a project using ASP.Net MVC3 and using membership for roles. i use authorize in every controller. eg:

[Authorize(Roles = \"Administrator\")]
    publ         


        
6条回答
  •  遥遥无期
    2020-12-23 22:57

    Well, you can inherit from AuthorizeAttribute and override HandleUnauthorizedRequest which is responsible for redirection of unauhorized/unauthenticated requests. i think this question will be helpful to you

提交回复
热议问题