Getting AD username from client

Discussion in 'ASP .Net' started by Jon, Jun 6, 2006.

  1. Jon

    Jon Guest

    I am trying to figure out how to get the client's AD username.

    So far everything I've found with google boils down to the following:
    System.Environment.UserName
    System.Security.Principal.WindowsIdentity.GetCurrent.Name

    But, they always give me the username ASPNET, which is what the IIS process
    runs as. How do I get the user's username without them having to type it in.
    What I'm trying to do is build an intranet website (without forms auth) that
    will seemlessly log the user in using their AD credentials without the user
    having to type anything into the website, simply go tothe URL and it picks
    up the AD username and checks that against our SQL database.

    Thanks
    Jon, Jun 6, 2006
    #1
    1. Advertising

  2. Jon

    Winista Guest

    Turn on impersonation along with windows auth in web.config and make sure
    windows auth is also turned on in iis.

    http://www.netomatix.com

    "Jon" <> wrote in message
    news:...
    >I am trying to figure out how to get the client's AD username.
    >
    > So far everything I've found with google boils down to the following:
    > System.Environment.UserName
    > System.Security.Principal.WindowsIdentity.GetCurrent.Name
    >
    > But, they always give me the username ASPNET, which is what the IIS
    > process runs as. How do I get the user's username without them having to
    > type it in. What I'm trying to do is build an intranet website (without
    > forms auth) that will seemlessly log the user in using their AD
    > credentials without the user having to type anything into the website,
    > simply go tothe URL and it picks up the AD username and checks that
    > against our SQL database.
    >
    > Thanks
    >
    Winista, Jun 6, 2006
    #2
    1. Advertising

  3. Jon

    Jon Guest

    Thanks for the info. Could you give a pointer or a link with a good
    description on what is involved with turning on impersonation.


    "Winista" <> wrote in message
    news:...
    > Turn on impersonation along with windows auth in web.config and make sure
    > windows auth is also turned on in iis.
    >
    > http://www.netomatix.com
    >
    > "Jon" <> wrote in message
    > news:...
    >>I am trying to figure out how to get the client's AD username.
    >>
    >> So far everything I've found with google boils down to the following:
    >> System.Environment.UserName
    >> System.Security.Principal.WindowsIdentity.GetCurrent.Name
    >>
    >> But, they always give me the username ASPNET, which is what the IIS
    >> process runs as. How do I get the user's username without them having to
    >> type it in. What I'm trying to do is build an intranet website (without
    >> forms auth) that will seemlessly log the user in using their AD
    >> credentials without the user having to type anything into the website,
    >> simply go tothe URL and it picks up the AD username and checks that
    >> against our SQL database.
    >>
    >> Thanks
    >>

    >
    >
    Jon, Jun 6, 2006
    #3
  4. Jon

    Winista Guest

    Here is a simple description of it..

    http://www.winista.com/thirdeye/default.aspx

    You may be able to find some detailed descriptions on MSDN about it.

    "Jon" <> wrote in message
    news:...
    > Thanks for the info. Could you give a pointer or a link with a good
    > description on what is involved with turning on impersonation.
    >
    >
    > "Winista" <> wrote in message
    > news:...
    >> Turn on impersonation along with windows auth in web.config and make sure
    >> windows auth is also turned on in iis.
    >>
    >> http://www.netomatix.com
    >>
    >> "Jon" <> wrote in message
    >> news:...
    >>>I am trying to figure out how to get the client's AD username.
    >>>
    >>> So far everything I've found with google boils down to the following:
    >>> System.Environment.UserName
    >>> System.Security.Principal.WindowsIdentity.GetCurrent.Name
    >>>
    >>> But, they always give me the username ASPNET, which is what the IIS
    >>> process runs as. How do I get the user's username without them having to
    >>> type it in. What I'm trying to do is build an intranet website (without
    >>> forms auth) that will seemlessly log the user in using their AD
    >>> credentials without the user having to type anything into the website,
    >>> simply go tothe URL and it picks up the AD username and checks that
    >>> against our SQL database.
    >>>
    >>> Thanks
    >>>

    >>
    >>

    >
    >
    Winista, Jun 6, 2006
    #4
  5. Jon

    Urso Guest

    If you have all the authentication set up properly. you can use:

    user.Identity.Name or Request.Params("LOGON_USER")

    Jon wrote:
    > Thanks for the info. Could you give a pointer or a link with a good
    > description on what is involved with turning on impersonation.
    >
    >
    > "Winista" <> wrote in message
    > news:...
    > > Turn on impersonation along with windows auth in web.config and make sure
    > > windows auth is also turned on in iis.
    > >
    > > http://www.netomatix.com
    > >
    > > "Jon" <> wrote in message
    > > news:...
    > >>I am trying to figure out how to get the client's AD username.
    > >>
    > >> So far everything I've found with google boils down to the following:
    > >> System.Environment.UserName
    > >> System.Security.Principal.WindowsIdentity.GetCurrent.Name
    > >>
    > >> But, they always give me the username ASPNET, which is what the IIS
    > >> process runs as. How do I get the user's username without them having to
    > >> type it in. What I'm trying to do is build an intranet website (without
    > >> forms auth) that will seemlessly log the user in using their AD
    > >> credentials without the user having to type anything into the website,
    > >> simply go tothe URL and it picks up the AD username and checks that
    > >> against our SQL database.
    > >>
    > >> Thanks
    > >>

    > >
    > >
    Urso, Jun 6, 2006
    #5
  6. Jon

    Jon Guest

    Thanks!


    "Winista" <> wrote in message
    news:OosQD$...
    > Here is a simple description of it..
    >
    > http://www.winista.com/thirdeye/default.aspx
    >
    > You may be able to find some detailed descriptions on MSDN about it.
    >
    > "Jon" <> wrote in message
    > news:...
    >> Thanks for the info. Could you give a pointer or a link with a good
    >> description on what is involved with turning on impersonation.
    >>
    >>
    >> "Winista" <> wrote in message
    >> news:...
    >>> Turn on impersonation along with windows auth in web.config and make
    >>> sure windows auth is also turned on in iis.
    >>>
    >>> http://www.netomatix.com
    >>>
    >>> "Jon" <> wrote in message
    >>> news:...
    >>>>I am trying to figure out how to get the client's AD username.
    >>>>
    >>>> So far everything I've found with google boils down to the following:
    >>>> System.Environment.UserName
    >>>> System.Security.Principal.WindowsIdentity.GetCurrent.Name
    >>>>
    >>>> But, they always give me the username ASPNET, which is what the IIS
    >>>> process runs as. How do I get the user's username without them having
    >>>> to type it in. What I'm trying to do is build an intranet website
    >>>> (without forms auth) that will seemlessly log the user in using their
    >>>> AD credentials without the user having to type anything into the
    >>>> website, simply go tothe URL and it picks up the AD username and checks
    >>>> that against our SQL database.
    >>>>
    >>>> Thanks
    >>>>
    >>>
    >>>

    >>
    >>

    >
    >
    Jon, Jun 6, 2006
    #6
    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. Mark

    Q329290 getting ASP.NET userName

    Mark, Aug 6, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    529
  2. Brian Henry

    getting username logged in

    Brian Henry, Aug 26, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    1,803
    Brian Henry
    Aug 27, 2003
  3. gertjan

    Getting ORIGINAL username

    gertjan, Jan 13, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    1,963
    gertjan
    Jan 13, 2004
  4. Jonathan Dixon

    Getting Windows Username

    Jonathan Dixon, Jul 21, 2004, in forum: ASP .Net
    Replies:
    8
    Views:
    1,732
  5. Shailesh Patel
    Replies:
    0
    Views:
    448
    Shailesh Patel
    Nov 8, 2006
Loading...

Share This Page