Forms Authentication User Name

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
 
K

Kumar Reddi

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());
 
A

ashish

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top