0

Possible Duplicate:
How can I attach a custom membership provider in my ASP.NET MVC application?

In ASP.NET MVC4 you can add attributes to your controllers/actions that restrict access to authenticated users or users that belong to certain roles.

I want to utilize this a project I'm working on, but I would rather not have to work with .NET Membership Provider. I would prefer to create my own database structure to keep track of users and roles and so forth.

What do I need to do in order to utilize the authentication attributes with my own custom membership implementation?

Community
  • 1
  • 1
jdavis
  • 8,255
  • 14
  • 54
  • 62

2 Answers2

1

Have you looked at this? It provides a method of doing this: http://www.danharman.net/2011/06/23/asp-net-mvc-3-custom-membership-provider-with-repository-injection/

jchapa
  • 3,876
  • 2
  • 25
  • 38
0

What do I need to do in order to utilize the authentication attributes with my own custom membership implementation

They aren't authentication attributes, they're authorization attributes.

To use them with your own roles, the easiest solution is to implement a custom RoleProvider, in which case the Authorize attribute should work automatically.

Joe
  • 122,218
  • 32
  • 205
  • 338