Forms Authentication User Name

Discussion in 'ASP .Net' started by ashish, Aug 15, 2006.

  1. ashish

    ashish Guest

    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
     
    ashish, Aug 15, 2006
    #1
    1. Advertising

  2. ashish

    Kumar Reddi Guest

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

    ashish wrote:
    > 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
     
    Kumar Reddi, Aug 15, 2006
    #2
    1. Advertising

  3. ashish

    ashish Guest

    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



    Kumar Reddi wrote:
    > 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());
    >
    > ashish wrote:
    >> 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

    >
     
    ashish, Aug 15, 2006
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Eric
    Replies:
    2
    Views:
    1,484
    Tommy
    Feb 13, 2004
  2. Don
    Replies:
    4
    Views:
    4,600
  3. nalbayo
    Replies:
    2
    Views:
    5,507
    Bruce Barker
    Nov 11, 2005
  4. Eric
    Replies:
    2
    Views:
    539
  5. Antonio O''Neal

    user.identity.name returns old AD user name

    Antonio O''Neal, Oct 31, 2008, in forum: ASP .Net Security
    Replies:
    5
    Views:
    2,075
    Antonio O''Neal
    Nov 3, 2008
Loading...

Share This Page