Create user within the Login Control

Discussion in 'ASP .Net' started by TheDude5B, Oct 31, 2007.

  1. TheDude5B

    TheDude5B Guest

    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
    TheDude5B, Oct 31, 2007
    #1
    1. Advertising

  2. 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!
    |
    *************************************************
    "TheDude5B" <> wrote in message
    news:...
    > 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
    >
    Cowboy \(Gregory A. Beamer\), Oct 31, 2007
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Don
    Replies:
    3
    Views:
    5,434
    Karl Seguin
    Mar 11, 2005
  2. Charlie@CBFC
    Replies:
    2
    Views:
    2,071
    S. Justin Gengo
    Oct 15, 2005
  3. Sasquatch
    Replies:
    2
    Views:
    1,290
    Sasquatch
    Oct 3, 2006
  4. Tony Johansson
    Replies:
    3
    Views:
    16,112
    Patrice
    Jan 2, 2010
  5. hmikki
    Replies:
    1
    Views:
    133
    Nathan Sokalski
    Oct 19, 2007
Loading...

Share This Page