ASP.Net membership check if account exists

I'm using Membership with ASP.Net. Is there a way to check if a username exists? On login, I'm checking to see if an account is locked out. But when a user enters in a username that is not in the system, they get the ugly YSOD error. I want to handle that more gracefully by giving them a message telling them the account does not exist and to contact the site admin. Is there a way to do this? I'm using C# code behind. Thanks.
Who is Participating?
fritzfrancisConnect With a Mentor Commented:
Use the Membership.GetUser(username) method. I believe this method returns a NULL if the user does not exist. Or maybe it throws an exception that you can catch.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.