0

I have a database table containing members with roles, I have an action that uses [Autorize(Roles="admin")] my probleme is how to tell Asp.net MVC which member is associated with which role ?

Younes Ch
  • 325
  • 2
  • 4
  • 14

1 Answers1

1

You will need to either use the default asp.net membership provider, which takes care of this, or you will need to role your own.

Basically, what you need is that when .net does user.IsInRole("admin"), the Principal will have that role in the list of Roles it was created with.

Andy T
  • 10,223
  • 5
  • 53
  • 95
  • give me the name of the class (default asp.net membership provider) – Younes Ch Feb 15 '13 at 20:02
  • Base one is: System.Web.Security.MembershipProvider, but if you are using SQL, you can use: System.Web.Security.SqlMembershipProvider. Set up: http://www.troyhunt.com/2011/10/5-minute-wonders-aspnet-membership.html – Andy T Feb 15 '13 at 20:06