I found MembershipProvider very useful. This allows me, as a developer, to use SQLMembershipProvider against the local user database, and then when I transfer it to production, I just use ActiveDirectoryMembershipProvider and I do not need to change the line of code (except for my web.config file).
Using your CustomMembershipProvider, you can overload any of the authentication methods and perform any other checks that you want to use inside these methods.
If you decide to switch to the MembershipProvider scheme, I donβt think you will regret it. It may be painful in the short term, but in the end, I think you will see that it paid off. Since you already have your authentication code written on your controller, is it not so difficult to combine it into a way to use MembershipProvider?
... is there a way to implement a minimum membership provider to perform these checks without passing all the authentication code to it?
MP is one of those cases where it is best to let him do what he does best. If you try to use only part of it here, and part of it there, when possible, will cause some headaches in the future. He knows what he must do and going around it, although it is possible, will require additional work, which may be unnecessary.
source share