Create user within the Login Control


T

TheDude5B

Hi,

I have a problem with existing customers from an old site, coming to
my new asp.net 2.0 site with the user roles and membership, and trying
to login with their old details.

As you know, the new built in membership encrypts passwords (I know
you can use the system without encrypting the passwords, but this what
i have unfortunetaly gone with), so I can not simply import the data
from the old database into the new one.

My idea was to create users on the fly if they try to log in user
their old details. Basically, when a user try's to login, if their
details dont exist in the new site, I will then search the old
database on LoginError using the details they have just provided
trying to login. If they are found in the old database, then I will
use their old details and create a new account for them.

So I can get their username and password which they type into the
Login Control, then I search the old database and get their details,
but then how can I go about creating a new account for them using the
asp.net memberships?
i.e. basically dynamically adding their details into the
CreateUserControl, and creating a user, but without the user seeing
this going on?

Is there such a way to do this?

or is there an easier way to import their old details into the new
system and encrypt their passwords?

Thanks
 
Ad

Advertisements

C

Cowboy \(Gregory A. Beamer\)

Yes, you can circumvent the way a person logs in to examine another table
and then allow them to log in. If you go this route, I would take the info
they are logging in with and "change" the password at that time. You can
also write your own membership provider that checks both places and even use
it to encrypt the password using the key in the web.config file (which is
what the built in membership FUD uses).

To do what you are intending, you will want to override event handlers from
the login control so you can look the user up when he logs in and create his
new account. Most likely you will override the LoggingIn event handler.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

*************************************************
| Think outside the box!
|
*************************************************
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top