Scenario:
Building an application for companies to enter information into.
I need to extend the built-in membership provider in asp.net. My unique situation is that I already have demographic information for each company, but NOT userid's and passwords for a web app. I want to prepopulate the DB with the demographic information, send each company a unique pin number, and ask them to register with my application. I want them to create a 开发者_运维百科userid, email address and password, after they've "validated" who they are by entering the pin number that they received in the mail. Yes, we'd be sending them, via snail mail, a unique pin number.
Problem:
Not quite sure where to start. The problem centers around the fact that we already have demographic information for these companies and right now, it's not possible to use this new web application to update the demographic info, so we really don't want them to change it. We also don't want just anybody being able to register an account and entering demographic information.
Questions:
Am I thinking about this the wrong way?
Is extending the membership provider the right way to go? What is the best way to handle this situation?Extending or implementing a membership provider is quite straightforward actually, and sounds like a good approach for your problem.
The only functionality of membership providers that most applications even use is the ValidateUser
method. In your case, you would simply override this method to fetch the customer name and pin from the database and match it with the user's input. If it matches, return true, otherwise, false.
Create a new class, inherit MembershipProvider. Right click the class name and implement the abstract methods, and you're off to the races. There are lots of walkthroughs and examples if you google for them as well.
精彩评论