Role Management in ASP MVC 5 (Microsoft.AspNet.Identity)

后端 未结 2 903
無奈伤痛
無奈伤痛 2021-02-10 10:50

in ASP MVC5 RC I didn\'t get the role system to work. My database has all needs tables an role exist but proofing if user is in role always return false (no SQL exception or som

2条回答
  •  不要未来只要你来
    2021-02-10 11:18

    User.IsInRole is basically looking at the claims for the currently signed in user. What does your sign in logic look like? That is what is responsible for minting the cookie that turns into the User identity. That needs to have the Role claim set properly for the IsInRole method to work correctly.

提交回复
热议问题