MVC 2 Cutom Membership Role Provider

MVC2, C#, IoC, DI, Unity and SQL Server 2008
(still struggling with the keywords little bit ).

I need to set up a custom member ship role provider. For this i need to

  • setup DB tables
  • front end logic

I am looking for a tutorial that can walk me from A -> Z. I have googled but still have not come up with some thing that is a complete tutorial. There are bits and pieces scattered all across the web.


Thanks, I am looking for a custom solution. The tables are already there. If i can then i’ll use those, if these need updating then i have the permission from the client.

You should be able to just create a subclass of MembershipProvider and RoleProvider, and put your logic into the overridden methods. You don’t have to implement everything - Just throw a NotImplementedException() in all the methods you don’t implement. After creating your custom subclasses, you set them in your Web.config

Start with the MembershipProvider, and when you get that working, implement a RoleProvider. The bare minimum you need to implement for the MembershipProvider is the ValidateUser method (for logging in), and CreateUser and a few properties for registration (if you need registration)

Is there any particular bit you’re having issues with?

ASP.NET 2.0 Provider Model: Introduction to the Provider Model

Building Custom Providers for ASP.NET 2.0 Membership

Source Code for the Built-in ASP.NET 2.0 Providers Now Available for Download - ScottGu’s Blog

I hope these will help