Custom Redirection if Roles don't match

家住魔仙堡 提交于 2019-12-06 15:03:29
KP.

You will need to write a custom authorization attribute like tvanfosson does in his answer Here.

You will then be able to do something like

[MyAuthorize(Roles = "Administrator,Paidmember", ViewName = "paidmember")]

This is working great for me.

What you can do is override the Authorize attribute, and return your own ActionResult, when the Role is the wrong one.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!