Logon user name is empty

Discussion in 'ASP .Net' started by Alan T, Jul 14, 2010.

  1. Alan T

    Alan T Guest

    ASP.NET 4.0

    I tried to get the Windows Logon user by:

    HttpContext.Current.User.Identity.Name.ToString();

    But it return empty.



    What I want to do is to get the full name of the logon user from Active
    Directory.
     
    Alan T, Jul 14, 2010
    #1
    1. Advertisements

  2. Alan T wrote:
    > ASP.NET 4.0
    >
    > I tried to get the Windows Logon user by:
    >
    > HttpContext.Current.User.Identity.Name.ToString();
    >
    > But it return empty.
    >
    > What I want to do is to get the full name of the logon user from Active
    > Directory.
    >


    Are you using authentication before allowing access to the application?
    Or is this a website with anonymous user access, where you happen to be
    logged into Windows on your machine while you are accessing the site,
    thinking the application will know which Windows user you are?
     
    Harlan Messinger, Jul 14, 2010
    #2
    1. Advertisements

  3. Alan T

    Alan T Guest

    >> ASP.NET 4.0
    >>
    >> I tried to get the Windows Logon user by:
    >>
    >> HttpContext.Current.User.Identity.Name.ToString();
    >>
    >> But it return empty.
    >>
    >> What I want to do is to get the full name of the logon user from Active
    >> Directory.
    >>

    >
    > Are you using authentication before allowing access to the application? Or
    > is this a website with anonymous user access, where you happen to be
    > logged into Windows on your machine while you are accessing the site,
    > thinking the application will know which Windows user you are?


    Hi,

    At the moment, I am just testing by running within VWD 2010 Express
    (locally) by pressing F5, and the Anonymous access disabled in IIS.

    I can use these to find out my logon user:
    string strName = Request.ServerVariables["LOGON_USER"];


    Response.Write(strName);



    It gives me, for example, that's correct:

    mydomain\smithj
     
    Alan T, Jul 15, 2010
    #3
  4. Alan T

    Harv Guest

    On Jul 14, 5:08 pm, "Alan T" <> wrote:
    > >> ASP.NET 4.0

    >
    > >> I tried to get the Windows Logon user by:

    >
    > >> HttpContext.Current.User.Identity.Name.ToString();

    >
    > >> But it return empty.

    >
    > >> What I want to do is to get the full name of the logon user from Active
    > >> Directory.

    >
    > > Are you using authentication before allowing access to the application? Or
    > > is this a website with anonymous user access, where you happen to be
    > > logged into Windows on your machine while you are accessing the site,
    > > thinking the application will know which Windows user you are?

    >
    > Hi,
    >
    > At the moment, I am just testing by running within VWD 2010 Express
    > (locally) by pressing F5, and the Anonymous access disabled in IIS.
    >
    > I can use these to find out my logon user:
    > string strName = Request.ServerVariables["LOGON_USER"];
    >
    > Response.Write(strName);
    >
    > It gives me, for example, that's correct:
    >
    > mydomain\smithj


    Alan,

    Do you have the Integrated Windows Authentication checked for the site?
     
    Harv, Jul 21, 2010
    #4
    1. Advertisements

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. venkat

    Retrieve logon user name from ADSI

    venkat, Nov 6, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    555
    venkat
    Nov 6, 2003
  2. nalbayo
    Replies:
    2
    Views:
    5,864
    Bruce Barker
    Nov 11, 2005
  3. Molly_K
    Replies:
    0
    Views:
    599
    Molly_K
    Aug 10, 2006
  4. =?Utf-8?B?Q2hhcmxlc0E=?=

    how can User.Identity.Name be empty?

    =?Utf-8?B?Q2hhcmxlc0E=?=, Mar 2, 2007, in forum: ASP .Net
    Replies:
    3
    Views:
    693
    Patrice
    Mar 2, 2007
  5. Kjell Kristiansson
    Replies:
    0
    Views:
    443
    Kjell Kristiansson
    Nov 30, 2005
  6. 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:
    3,243
    Antonio O''Neal
    Nov 3, 2008
  7. Kelly

    Grab a User's Logon name in ASP.NET form?

    Kelly, Mar 10, 2005, in forum: ASP .Net Web Controls
    Replies:
    4
    Views:
    296
    Kelly
    Mar 15, 2005
  8. Replies:
    3
    Views:
    255
    darth
    Mar 10, 2005
Loading...