문제

How do I order the [Authorize] attribute to connect to my own Roles database to check for specifics roles in there?

What I know:

  • I have to create a class that inherits from AuthorizeAttribute.

What I don't know:

  • What to write inside my custom class in the way that [CustomAuthorize(Roles: "Administrator")] checks if the current user has that role.

Please, I really need help with this.

도움이 되었습니까?

해결책

Override the AuthorizeCore() method and return true or false.

다른 팁

Simply create a custom RoleProvider to work with the ASP.NET Identification.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top