Reputation: 317
I am developing an ASP .Net MVC 3 application using C# and SQL Server 2005.
I am using also Entity Framework and Code First Method.
I have an interface Login that works perfectly.
My problem that I have 3 Types of Users :
and each one has a custom access to the pages of the application.
I search on the net and I found many tutos describing how to manage Roles but all are not using a database or using an existing database with ADO .NET, database first
My problem that I am using ENTITY FRAMEWORK and CODE FIRST.
This is what I have in my base . How can I bind this tables with my code ? I already used [Authorize]
in some action and its works perfectly but now how I use [Authorize (Roles="Admin")]
with my database.
Upvotes: 0
Views: 1217
Reputation: 1223
It may be that you are looking for in the MVC custom role provider.
You can check this:
http://kitsula.com/Article/Custom-Role-Provider-for-MVC https://codefirstmembership.codeplex.com/ http://techbrij.com/custom-roleprovider-authorization-asp-net-mvc http://www.mattwrock.com/post/2009/10/14/Implementing-custom-Membership-Provider-and-Role-Provider-for-Authinticating-ASPNET-MVC-Applications.aspx http://www.danharman.net/2011/06/23/asp-net-mvc-3-custom-membership-provider-with-repository-injection/ http://www.codeproject.com/Articles/165159/Custom-Membership-Providers How to use Membership provider with EF Code First?
Upvotes: 1