• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 632
  • Last Modified:

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.
1 Solution
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.

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now