facing a problem

Discussion in 'ASP .Net' started by hussein_hariri@hotmail.com, Dec 26, 2003.

  1. Guest

    hello
    i have started working bye ASP.net but i'm facing a small
    problem. i'm trying to get the name of the user who
    logedon to the opersating system , i got the computer
    name, server name, domain name, and the name of the user
    who started the studio.net { ASPNET }. but the one who
    logged on to the operating system i was not able to so any
    one can help me?
    thank you for responding
    , Dec 26, 2003
    #1
    1. Advertising

  2. You can get the name of the person logged on to the application with
    ASP.NET, but that does not necessarily mean the person logged onto the OS,
    as a person can type in a different account when the Windows Authentication
    logon pops up. If you need that person, you can use:

    private string GetUserNumber()
    {
    // Set up character(s) to split on
    char[] splitChar = @"\".ToCharArray();

    // Split user to get user ID only
    string[] user = Request.ServerVariables["LOGON_USER"].Split(splitChar);
    int userArrayMax = user.Length-1;


    // This is designed for lookup of user
    return user[userArrayMax];
    }

    This returns the string of the account logged into the ASP.NET app. The
    problem here, as stated, is the person logged onto the computer and the
    person logged into the app can be different.

    --
    Gregory A. Beamer
    MVP; MCP: +I, SE, SD, DBA

    **********************************************************************
    Think Outside the Box!
    **********************************************************************
    "" <> wrote in
    message news:037b01c3cbcd$4ba95a70$...
    > hello
    > i have started working bye ASP.net but i'm facing a small
    > problem. i'm trying to get the name of the user who
    > logedon to the opersating system , i got the computer
    > name, server name, domain name, and the name of the user
    > who started the studio.net { ASPNET }. but the one who
    > logged on to the operating system i was not able to so any
    > one can help me?
    > thank you for responding
    >
    Cowboy \(Gregory A. Beamer\), Dec 26, 2003
    #2
    1. Advertising

  3. To display the user logged into the OS, See that the Anonymous user option in the IIS is off and read this value
    "HttpContext.Current.User.Identity.Name"
    =?Utf-8?B?U2h5YW0gUmVtZWxsYQ==?=, Dec 27, 2003
    #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. Konark Khera
    Replies:
    0
    Views:
    492
    Konark Khera
    Mar 22, 2005
  2. Anubhav Jain
    Replies:
    0
    Views:
    441
    Anubhav Jain
    Mar 20, 2006
  3. Amratash
    Replies:
    0
    Views:
    520
    Amratash
    Apr 13, 2004
  4. Hema S via DotNetMonster.com

    Facing Session Timeout problem

    Hema S via DotNetMonster.com, Apr 21, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    396
    Brock Allen
    Apr 21, 2005
  5. msnews.microsoft.com

    Problem Facing in Server Side Validation.

    msnews.microsoft.com, May 20, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    512
    Peter Blum
    May 21, 2005
Loading...

Share This Page