can I make use of user.IsInRole without using Membership?

后端 未结 4 1372
情深已故
情深已故 2021-01-14 15:52

I\'m using Forms authentication and I would like to make use of roles, can I somehow set the role of the user without Membership ?

4条回答
  •  情书的邮戳
    2021-01-14 16:45

    Yes you can.

    The only caveat is that roles will not work with an anonymous user (fairly obvious I would have thought) and you'll need some mechanism to set a user's identity (which can be anything you like).

    The MSDN article:

    Understanding Role Management

    contains the following information:

    However, role management does not depend on membership. As long as you have a way in your application to set user identity, you can use role management for authorization.

提交回复
热议问题