2

I'm using forms authentication on a very small ASP.NET web app (Web Forms) in which I want to store additional info about the user in a separate database table.

This is then linked back to the aspnet_User table and I was figuring the best column to link to is the UserId column. Problem is I can't work out how to get this piece of data when the user is logged in. Is it even possible?

Also, how do I get the email address?


Before someone points it out, I am aware of the ProfileProvider but the details stored need to be re-submitted each year (it's a registration application for a sporting club) and all previous data stored. So the ProfileProvider isn't really applicable (unless I'm wrong and it can be used to have it stored historically?).

1 Answer 1

2

here's how you can get the userid

MembershipUser myObject = Membership.GetUser();
string UserID = myObject.ProviderUserKey.ToString();
string Email = myObject.Email;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.