Checking database for existing user before logging in (C#)

Hello,

I was wondering what would be the easiest way to check for exisiting users in my database before allowing users to login to a webform. I have a login screen which prompts the user to enter in their UserID and their Password, I would like to check the database after the user hits the submit button to see if the user exists in the database and if they do it will allow them to proceed into the webform, but if they do not exist to have an error message stating that either the UserID does not exists or incorrect and that the password does not exists or incorrect. Any help with this would be great. Thank you

James

Comments

  • you can use a custom validator and in it's ServerValidate Event you can write the code to check for users existence. if the user exists set
    args.IsValid = true
    else
    args.IsValid = false

    and in submit buttons click event write on top

    if (!Page.IsValid)
    return;

    Enjoy



Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion