Reputation: 8373
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?
Upvotes: 0
Views: 250
Reputation: 1058
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..
Upvotes: 0
Reputation: 43087
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.
Upvotes: 1