Get the current logged in user name

Discussion in 'ASP .Net Security' started by Imran Aziz, Aug 2, 2005.

  1. Imran Aziz

    Imran Aziz Guest

    Hello All,
    I am new to .net. I want to use windows authentication to authenticate
    against the current logged in user on the client machine. I believe by using
    windows authentication method, the IIS will send me details of the current
    logged in user at the client machine if integrated windows authentication is
    enabled at IIS. Can anyone please guide me how I can get the name of the
    current logged in client that is making a request to my ASP.net application
    ?

    I am trying to look into System.Web.Security class for this but have not
    been able to find a piece of code or guidance of how to do it.

    Imran.
    Imran Aziz, Aug 2, 2005
    #1
    1. Advertising

  2. See http://msdn.microsoft.com/library/en-us/dnnetsec/html/SecNetAP05.asp for
    a list of the three properties that expose user identity information that
    may be useful in your application, as well as descriptions of how various
    IIS and ASP.NET authentication and identity configurations affect the
    property values.



    "Imran Aziz" <> wrote in message
    news:...
    > Hello All,
    > I am new to .net. I want to use windows authentication to authenticate
    > against the current logged in user on the client machine. I believe by
    > using windows authentication method, the IIS will send me details of the
    > current logged in user at the client machine if integrated windows
    > authentication is enabled at IIS. Can anyone please guide me how I can get
    > the name of the current logged in client that is making a request to my
    > ASP.net application ?
    >
    > I am trying to look into System.Web.Security class for this but have not
    > been able to find a piece of code or guidance of how to do it.
    >
    > Imran.
    >
    Nicole Calinoiu, Aug 2, 2005
    #2
    1. Advertising

  3. Imran Aziz

    Brock Allen Guest

    User.Identity.Name

    -Brock
    DevelopMentor
    http://staff.develop.com/ballen



    > Hello All,
    > I am new to .net. I want to use windows authentication to
    > authenticate
    > against the current logged in user on the client machine. I believe by
    > using
    > windows authentication method, the IIS will send me details of the
    > current logged in user at the client machine if integrated windows
    > authentication is enabled at IIS. Can anyone please guide me how I can
    > get the name of the current logged in client that is making a request
    > to my ASP.net application ?
    >
    > I am trying to look into System.Web.Security class for this but have
    > not been able to find a piece of code or guidance of how to do it.
    >
    > Imran.
    >
    Brock Allen, Aug 2, 2005
    #3
  4. Imran Aziz

    Imran Aziz Guest

    I cannot seem to find the container class for this property.

    It surly is not the member of System.Web.Security or am I wrong?

    Imran.

    "Brock Allen" <> wrote in message
    news:...
    > User.Identity.Name
    >
    > -Brock
    > DevelopMentor
    > http://staff.develop.com/ballen
    >
    >
    >
    >> Hello All,
    >> I am new to .net. I want to use windows authentication to
    >> authenticate
    >> against the current logged in user on the client machine. I believe by
    >> using
    >> windows authentication method, the IIS will send me details of the
    >> current logged in user at the client machine if integrated windows
    >> authentication is enabled at IIS. Can anyone please guide me how I can
    >> get the name of the current logged in client that is making a request
    >> to my ASP.net application ?
    >>
    >> I am trying to look into System.Web.Security class for this but have
    >> not been able to find a piece of code or guidance of how to do it.
    >>
    >> Imran.
    >>

    >
    >
    >
    Imran Aziz, Aug 2, 2005
    #4
  5. Imran Aziz

    Brock Allen Guest

    This was in the context of a Control or the Page. Another way is to call:

    HttpContext.Current.User.Identity.Name

    -Brock
    DevelopMentor
    http://staff.develop.com/ballen



    > I cannot seem to find the container class for this property.
    >
    > It surly is not the member of System.Web.Security or am I wrong?
    >
    > Imran.
    >
    > "Brock Allen" <> wrote in message
    > news:...
    >
    >> User.Identity.Name
    >>
    >> -Brock
    >> DevelopMentor
    >> http://staff.develop.com/ballen
    >>> Hello All,
    >>> I am new to .net. I want to use windows authentication to
    >>> authenticate
    >>> against the current logged in user on the client machine. I believe
    >>> by
    >>> using
    >>> windows authentication method, the IIS will send me details of the
    >>> current logged in user at the client machine if integrated windows
    >>> authentication is enabled at IIS. Can anyone please guide me how I
    >>> can
    >>> get the name of the current logged in client that is making a
    >>> request
    >>> to my ASP.net application ?
    >>> I am trying to look into System.Web.Security class for this but have
    >>> not been able to find a piece of code or guidance of how to do it.
    >>>
    >>> Imran.
    >>>
    Brock Allen, Aug 2, 2005
    #5
  6. Imran Aziz

    Imran Aziz Guest

    Brock thanks a lot for that, it does give me the login name along with the
    domain prefix.
    Thanks.

    "Brock Allen" <> wrote in message
    news:...
    > This was in the context of a Control or the Page. Another way is to call:
    >
    > HttpContext.Current.User.Identity.Name
    >
    > -Brock
    > DevelopMentor
    > http://staff.develop.com/ballen
    >
    >
    >
    >> I cannot seem to find the container class for this property.
    >>
    >> It surly is not the member of System.Web.Security or am I wrong?
    >>
    >> Imran.
    >>
    >> "Brock Allen" <> wrote in message
    >> news:...
    >>
    >>> User.Identity.Name
    >>>
    >>> -Brock
    >>> DevelopMentor
    >>> http://staff.develop.com/ballen
    >>>> Hello All,
    >>>> I am new to .net. I want to use windows authentication to
    >>>> authenticate
    >>>> against the current logged in user on the client machine. I believe
    >>>> by
    >>>> using
    >>>> windows authentication method, the IIS will send me details of the
    >>>> current logged in user at the client machine if integrated windows
    >>>> authentication is enabled at IIS. Can anyone please guide me how I
    >>>> can
    >>>> get the name of the current logged in client that is making a
    >>>> request
    >>>> to my ASP.net application ?
    >>>> I am trying to look into System.Web.Security class for this but have
    >>>> not been able to find a piece of code or guidance of how to do it.
    >>>>
    >>>> Imran.
    >>>>

    >
    >
    >
    Imran Aziz, Aug 2, 2005
    #6
  7. "Imran Aziz" <> wrote in message
    news:...
    > Hello All,
    > I am new to .net. I want to use windows authentication to authenticate
    > against the current logged in user on the client machine. I believe by
    > using windows authentication method, the IIS will send me details of the
    > current logged in user at the client machine if integrated windows
    > authentication is enabled at IIS. Can anyone please guide me how I can get
    > the name of the current logged in client that is making a request to my
    > ASP.net application ?
    >
    > I am trying to look into System.Web.Security class for this but have not
    > been able to find a piece of code or guidance of how to do it.
    >
    > Imran.


    I used this in my ASP pages and still use it in ASP.NET although there's
    obviously many other was to achieve the same/similar result.

    Dim strWho as String
    strWho = Request.ServerVariables("AUTH_USER")
    or
    strWho = Request.ServerVariables("LOGON_USER")

    HTH,
    Jim
    Jim in Arizona, Aug 3, 2005
    #7
  8. Imran Aziz

    Pat Guest

    Yeah it would give the Domain prefix like DOMAIN\Username.
    If you are authenticated in the domain.Whan you can do is to remove the
    Domain prefix if you don't need it.
    Patrick


    "Imran Aziz" <> wrote in message
    news:...
    > Brock thanks a lot for that, it does give me the login name along with the
    > domain prefix.
    > Thanks.
    >
    > "Brock Allen" <> wrote in message
    > news:...
    > > This was in the context of a Control or the Page. Another way is to

    call:
    > >
    > > HttpContext.Current.User.Identity.Name
    > >
    > > -Brock
    > > DevelopMentor
    > > http://staff.develop.com/ballen
    > >
    > >
    > >
    > >> I cannot seem to find the container class for this property.
    > >>
    > >> It surly is not the member of System.Web.Security or am I wrong?
    > >>
    > >> Imran.
    > >>
    > >> "Brock Allen" <> wrote in message
    > >> news:...
    > >>
    > >>> User.Identity.Name
    > >>>
    > >>> -Brock
    > >>> DevelopMentor
    > >>> http://staff.develop.com/ballen
    > >>>> Hello All,
    > >>>> I am new to .net. I want to use windows authentication to
    > >>>> authenticate
    > >>>> against the current logged in user on the client machine. I believe
    > >>>> by
    > >>>> using
    > >>>> windows authentication method, the IIS will send me details of the
    > >>>> current logged in user at the client machine if integrated windows
    > >>>> authentication is enabled at IIS. Can anyone please guide me how I
    > >>>> can
    > >>>> get the name of the current logged in client that is making a
    > >>>> request
    > >>>> to my ASP.net application ?
    > >>>> I am trying to look into System.Web.Security class for this but have
    > >>>> not been able to find a piece of code or guidance of how to do it.
    > >>>>
    > >>>> Imran.
    > >>>>

    > >
    > >
    > >

    >
    >
    Pat, Aug 29, 2005
    #8
  9. Imran Aziz

    Pat Guest

    Thas true jim that will still do the trick in ASP.NET

    "Jim in Arizona" <> wrote in message
    news:...
    > "Imran Aziz" <> wrote in message
    > news:...
    > > Hello All,
    > > I am new to .net. I want to use windows authentication to authenticate
    > > against the current logged in user on the client machine. I believe by
    > > using windows authentication method, the IIS will send me details of the
    > > current logged in user at the client machine if integrated windows
    > > authentication is enabled at IIS. Can anyone please guide me how I can

    get
    > > the name of the current logged in client that is making a request to my
    > > ASP.net application ?
    > >
    > > I am trying to look into System.Web.Security class for this but have not
    > > been able to find a piece of code or guidance of how to do it.
    > >
    > > Imran.

    >
    > I used this in my ASP pages and still use it in ASP.NET although there's
    > obviously many other was to achieve the same/similar result.
    >
    > Dim strWho as String
    > strWho = Request.ServerVariables("AUTH_USER")
    > or
    > strWho = Request.ServerVariables("LOGON_USER")
    >
    > HTH,
    > Jim
    >
    >
    Pat, Aug 29, 2005
    #9
    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. keithb
    Replies:
    0
    Views:
    616
    keithb
    Feb 16, 2006
  2. Replies:
    1
    Views:
    929
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Apr 12, 2007
  3. Shaminda Illangantilaka

    How can I get the current logged user information

    Shaminda Illangantilaka, Jan 4, 2006, in forum: ASP .Net Security
    Replies:
    2
    Views:
    138
    Patrick.O.Ige
    Jan 25, 2006
  4. mvr
    Replies:
    5
    Views:
    533
    Aaron Bertrand [SQL Server MVP]
    May 16, 2006
  5. Rodrigo Bermejo

    Windows - Get current logged user

    Rodrigo Bermejo, Sep 28, 2007, in forum: Ruby
    Replies:
    13
    Views:
    403
    Devi Web Development
    Oct 24, 2007
Loading...

Share This Page