Verify user exits

Hi Experts.

I"ve been searching forever and can't seem to find out how to verify that a user exists in 2.0
 I'm using the Authorization/Membership Management and c#

Who is Participating?
If you are using ASP.Net Membership here is one way to find if a UserExists or not.
Below is sample code:
You can check othe Membership API methods to see if any other matches your requirements.
Also the is Roles API you might want to look into if you want to deal with Roles.

 MembershipUser user = Membership.GetUser("YourUserName");
        if (user != null)
         Response.Write("User is null");

Open in new window

tenderroni992003Author Commented:
I tried the above solution, and it always returns null.

admin: relevance: 2.0, c#,  microsoft programming

make sure your membership is working properly.
i.e. Are you able to create new user and login with that username?
Please provide more info on what exactly you did and what exactly you are looking for.
tenderroni992003Author Commented:
guro_sami, your solution was absolutely correct!  Thank you!

I fond my error.  I was getting the string from a text box, but I wasn't converting the textbox text to a string.  I thought that you could stop at textbox.Text, but you actually have to have
so the following works:  Membership.GetUser(textbox.Text.ToString())
Go figure.

Thank you so much!

tenderroni992003Author Commented:
Thank yo so much for all of your wonderful help!
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.