i can get the user name as : User.Identity.Name
. How can I user's email address because it must be stored (there is a textbox for it in the registration form)?
if(User.Identity.IsAuthenticated)
{
someLabel.Text = Membership.GetUser().Email;
}
There are a lot of useful user properties resulting from the Membership.GetUser()
function. It returns an object of type MembershipUser
.
protected string GetEmailAddress()
{
MembershipUser currUser = null;
if (HttpContext.Current.User != null)
{
currUser = Membership.GetUser(true);
return currUser.Email;
}
return currUser.Email;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With