3

i am building a custom membership provider in Asp.net MVC 3

i am getting all the things right ... but had a question in mind that do we have to provide all the properties like mentioned below.

private string _ApplicationName;
        private bool _EnablePasswordReset;
        private bool _EnablePasswordRetrieval = false;
        private bool _RequiresQuestionAndAnswer = false;
        private bool _RequiresUniqueEmail = true;
        private int _MaxInvalidPasswordAttempts;
        private int _PasswordAttemptWindow;
        private int _MinRequiredPasswordLength;
        private int _MinRequiredNonalphanumericCharacters;
        private string _PasswordStrengthRegularExpression;
        private MembershipPasswordFormat _PasswordFormat = MembershipPasswordFormat.Hashed;

Or is it possible to just declare those actually i am gonna need it in my application... few of them i dont need it and i was thinking rather then declaring it in my database if i could just ignore tham...

please help .

patel.milanb
  • 5,450
  • 14
  • 52
  • 86

2 Answers2

1

You can actually implement only the required features as long as your Membership provider implements all required functions.

I know it is not rare just to implement the basic things and leave off things like question and answer.

Sascha
  • 9,732
  • 3
  • 38
  • 61
  • 1
    @patel.milanb just implement what your app uses, nothing more, see how I implemented in this answer: http://stackoverflow.com/questions/5701673/custom-membershipprovider-in-net-4-0/5702000#5702000 – balexandre Sep 08 '11 at 17:45
0

If you are writing your implpementation, and you are sure you will not use them, than jsut don't implement them.

Anyway I will suggest you to implement correctly all of them because they are also used in the config file and you may need them in your next project (I mean, they are a bunch of properties, and you risk to broke some functionality by not implementing some functions).

There are also plenty of MembershipProviders on codeplex (with nhibernate or not) that you can use as a starting point without having to write all from scratch.

Iridio
  • 9,073
  • 3
  • 44
  • 69