0

I am developing an intranet application with Windows Authentication, I have implemented a custom role provider and tied that in with my repository which has Users and Roles.

I use [Authorize(Role="Administrator")] on my controller class. I am logged in as "UserA", and I have implemented GetRolesForUser(string username). Additionally, "UserA" is an "Administrator" role however Authorization still seems to fail.

Do I still have to implement the MembershipProvider?

tereško
  • 58,060
  • 25
  • 98
  • 150
Seth
  • 8,213
  • 14
  • 71
  • 103

2 Answers2

1

Windows Authentication does not require a MembershipProvider. You can use any RoleProvider you want.

One thing to check in your role provider is how the username is stored. The Windows Authentication identity is DOMAIN\UserName. Make sure your role provider stores usernames in the same format.

jrummell
  • 42,637
  • 17
  • 112
  • 171
0

Yes,you can implement Role-provider without Membeship Provider definitely...

If you're looking to write a role provider, use the existing role provider code for a starting point or learning exercise. Get it from..

Role ProviderToolKitSamples

Rahul Ranjan
  • 1,028
  • 1
  • 10
  • 27