Get current user

  • Thread starter Thread starter shapper
  • Start date Start date
hi...
Miguel

if (Page.User.Identity.IsAuthenticated)
{
MembershipUser user =
Membership.GetUser(Page.User.Identity.Name);
user.Email = "(e-mail address removed)";
}

this is the code to get a logged in user

Thanks
Masudurhttp://www.kaz.com.bdhttp://munnacs.110mb.com

I was using:
Membership.GetUser(HttpContext.Current.User.Identity.Name)

What is the difference?
Which one should I use?

Thanks,
Miguel

P.S: I am using ASP.NET 2.0 Membership
 
hi...
Miguel

if (Page.User.Identity.IsAuthenticated)
{
MembershipUser user =
Membership.GetUser(Page.User.Identity.Name);
user.Email = "(e-mail address removed)";
}

this is the code to get a logged in user

Thanks
Masudurhttp://www.kaz.com.bdhttp://munnacs.110mb.com

Hi,

I am using the following code to authenticate a user and access its
email.
My problem is that some times when I run the page the user is not
authenticated and I get an when I try to change its email.
Other times it works fine. I don't know why:

FormsAuthentication.Authenticate("usr", "pass")
FormsAuthentication.SetAuthCookie("usr", True)
Membership.GetUser(HttpContext.Current.User.Identity.Name).Email =
"(e-mail address removed)"

Thanks,
Miguel
 
Back
Top