question regarding checking if user exists, customValidator

Discussion in 'ASP .Net' started by Jeff, Jan 27, 2009.

  1. Jeff

    Jeff Guest

    hi

    asp.net 3.5

    On my website I want to implement a customValidor on the registration page,
    so that a custom error appear when someone trys to register a user who
    already exists...

    So I'm wondering about how to do that script the check if that user already
    exists....

    My approach:
    MembershipUser user = Membership.GetUser( <name entered in textbox> );
    if (user == null)
    return false;
    else
    return true;

    Don't think that apprach is optimal, so I hope maybe there are some better
    ways of doing this..

    any suggestions?
     
    Jeff, Jan 27, 2009
    #1
    1. Advertisements

  2. The approach may not be "optimal", but user sign ups are not the primary
    reason sites exist, so an "unoptimal" sign up is not a problem. I also
    prefer this method to attempt to create and bomb, which is your other
    option.The bomb methodology is even less optimal.

    On a small site, you can load all users into a hashtable, or similar, and
    have a very quick lookup. On a small site, this is "optimal", but it is
    overbearing on a large site.

    You can have the check set up in AJAX and give instant feedback. The
    methodology may still not be "optimal", but it is nicer for the user than
    hit submit and find out things have gone wrong.
     
    Cowboy \(Gregory A. Beamer\), Jan 27, 2009
    #2
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.