ASP.Net membership check if account exists

Posted on 2012-08-20
Last Modified: 2012-08-20
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.
Question by:dodgerfan
    1 Comment
    LVL 4

    Accepted 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.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
    International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now