Asp.net MVC Authorize attribute, redirect to custom “no rights” page

前端 未结 5 1477
醉梦人生
醉梦人生 2021-01-31 09:08

Asp.net MVC2 does redirect to login page with response 302 when authenticated user has no rights.

I would like to split into two actions

  1. If us
5条回答
  •  情话喂你
    2021-01-31 09:28

    As suggested in Customizing authorization in ASP.NET MVC, you could subclass the AuthorizeAttribute to intercept the authenticated-but-unauthorized scenario and replace the result with a redirect.

提交回复
热议问题