Simple custom roles for windows authentication in asp. net?

Bonk picture Bonk · Apr 28, 2012 · Viewed 20.8k times · Source

At our company network, the roles in Active Directory(AD) are not appropriately assigned for my application. So I created a simple table in my database mapping all the users in the AD and their roles. There is literally only two columns in this table, user and role.

I hope to take advantage of the powerful role management in asp.net, I want to use features like [Authorize(Roles = "Managers")]. is there a simple way to use these custom roles without setting up complicated role and membership provider?

application background: sql server, linq, asp.net mvc

Answer

Shaman picture Shaman · Apr 28, 2012

It is really easy to implement custom role provider. Basically you will need to implement two functions.

Look at the article: Custom Role Provider for MVC