This project is read-only.

Inital Seeding Problem

Jul 24, 2013 at 6:15 PM

Thanks to your articles I have been able to use my existing member database with SimpleMembership, implement Email registration confirmation and the password reset. I have a problem I have not been able to solve. I will be populating the database eventually by importing data to it. With this complete there will not be associated records in the webpages_Membership table nor will they have passwords.

What avenue would you take to implement this? Thanks.
Jul 24, 2013 at 7:44 PM

I am not sure I understand what problem you are trying to solve. Would you please expand on what the problem is. What do you mean when you say they will not have passwords? Do you mean that the webpages_Membership table will not have passwords and that they are in your existing member database, or are you not using passwords at all. Is the problem that you are not sure how to authenticate? What method did you use to integrate your existing member database?
Jul 24, 2013 at 10:28 PM

Let me try and do a better job of explaining. I'm building a web app for an organization I belong to. I chose originally to put the members info into a table called Member. The current data is available to me in an Excel spreadsheet so I have imported some 100 or so records into the Member table.

I did not want to require our current members to have to go through a registration process. My preference would be to send them an email with a password and have them go log in and change the password. As I researched using SimpleMembership and read through your blogs and some others I learned how to use my current Member table in place of UserProfile and map my PrimaryEmail field as the UserName.

With this in mind I have 100 or so records in my Member table with no corresponding record in webpages_Membership table except for a few I've created manually or done through the registration process to verify that it and your registration email piece worked.

My desire is to have a plan to create records for the remaining members in the webpages_Membership table in the easiest possible manner. I'm really just looking for suggestions to accomplish this and I can run off and figure it out from there, I hope.

BTW this is not my main profession. I am really a good hardware guy with about 30 years in the cableTV industry who just happens to like playing with this stuff. My son does do it for a living and I am able to use him as a crutch occasionally to bounce things off or to give me a nudge when I get stuck.

Jul 25, 2013 at 1:50 PM

My suggestion is to create an import process that loops through your import records and calls the WebSecurity.CreateUserAndAccount Method and set requireConfirmationToken to false. For each record also call the WebSecurity.GeneratePasswordResetToken method to get a password reset token. This can be emailed to the user automatically as part of the import process. For information on how to setup password reset read this article. The email can introduce the users to the new site and all they have to do is click on the link and enter a new password that they will remember and use from then on. If you setup the site with the email reset as described in the article this will also allow them to reset their password or change it if they forget it at any time.

This is more secure than sending passwords in emails. The token expires after a while and all the user has to do is go through the password reset process again if it does expire. Emails with passwords can get in the wrong hands and is always available to hackers until the user changes the password anyway.
Jul 30, 2013 at 2:41 PM

Thanks for your suggestion. I had already implemented your password reset. I used your suggestion for accomplishing what I need using an email and the token. Appreciate the help in sending me in the right direction!