spyke
spyke

Reputation: 385

ASP.NET MVC 3 Custom MembershipProvider and MembershipUser

I do my little project on ASP.NET MVC 3 with EF Model and custom user tables (mostly for education). I read the tutorial and I know that I must inherit from MembershipProvider to make my custom one. I do not have any roles in this project. I just want to make simple authentication by email and password (custom password hashing and etc.) with no extra features. In default MembershipProvider all authorization does by username. But in my project it does by email, username is using for other purposes. Questions:

  1. How to swap email and username?
  2. If I will use [Authorize] attribute, must I use RoleProvider and is there any required members in MembershipProvider class to implement for using that attribute?
  3. Maybe do not inherit and do not use MembershipProvider at all? Just use my own Repository class for authorization and authentication?

Upvotes: 0

Views: 420

Answers (1)

Erik Funkenbusch
Erik Funkenbusch

Reputation: 93444

  1. just put their email address in the username field.
  2. No, you don't need RoleProvider.
  3. You can implement any authentication you want, but you should stick with Membership unless you have a specific reason not to.

Upvotes: 2

Related Questions