Forms Authentication User Name

  • Thread starter Thread starter ashish
  • Start date Start date
A

ashish

I have written a simple forms authentication login page, where a user is
redirected to default page after he is logged in ...

the login page submit button looks like

FormsAuthentication.RedirectFromLoginPage(user.Email, false);


Is it possible to get user email on other pages ....

I tried

Response.Output.WriteLine("Page UserName " + Page.User.Identity.Name);


but it doesnt works...

thanks
 
You should be able to get it.. if they are web forms..

Anyway , try with the following code

System.Web.Security.FormsIdentity id =
(System.Web.Security.FormsIdentity) HttpContext.Current.User.Identity;
Response.Output.WriteLine("Page UserName " + id.Name.ToString());
 
Kumar,
thanks for the answer but it still doesnt works :(


Other thing i might want to add is that anonymous user setting is on,
and I have custom membership and profile providers...


I can send you the complete code if you want...

regards
 
Back
Top