Re: Getting Logged in Windows user name

From: Richard L Rosenheim (richard_at_rlr.com)
Date: 02/04/05

  • Next message: Joe Kaplan \(MVP - ADSI\): "Re: Getting Logged in Windows user name"
    Date: Fri, 4 Feb 2005 14:34:54 -0800
    
    

    Maybe have the server create a cookie with the server's logged in name that
    the application then can read?

    Just a thought,

    Richard Rosenheim

    "Joe Kaplan (MVP - ADSI)" <joseph.e.kaplan@removethis.accenture.com> wrote
    in message news:OHgW7LwCFHA.1936@TK2MSFTNGP14.phx.gbl...
    > Ah, I think I see. On the server side, it depends on what code you have
    > executing there. In ASP.NET if you are using Windows/IIS authentication,
    > you can check the Context.User.Name property to see who logged on. In
    ASP,
    > you generally check the server variables. However, I don't see how you
    > could use either of those on the exe file as it is probably being served
    by
    > IIS directly without going through ASP or ASP.NET.
    >
    > IS will log the logged on user's name its log for each request. That
    might
    > be what you want.
    >
    > You could also possibly map a wild card map to ASP.NET and capture the
    > user's name in an HttpModule on the server before sending down the
    request.
    > People do this stuff all the time so they can protect non-ASP.NET
    resources
    > using ASP.NET authorization.
    >
    > Do you need to somehow pass the user name the user logged on with remotely
    > to the local application? I'm not sure how you'd do that without having
    it
    > some sort of a web service call back to the server or something.
    >
    > Once your application starts to execute on the local machine though, the
    > process is local.
    >
    > I guess I am a little confused about what you are up to, but hopefully
    this
    > helped.
    >
    > Joe K.
    >
    > "Joe" <J_no_spam@_no_spam_Fishinbrain.com> wrote in message
    > news:%23W9z87vCFHA.328@tk2msftngp13.phx.gbl...
    > >I guess I'm just not making myself clear.
    > >
    > > I know how to use WindowsIdentity.GetName().Name. This returns to me the
    > > currently logged on user of the local machine where the application is
    > > running. This is not what I need.
    > >
    > > I need to know the login the user used on the machine which is hosting
    the
    > > application. Remember, the application is being sent to the user via
    > > no-touch deployment.
    > >
    > > Here's an example of the what happens:
    > >
    > > The user clicks a link http://mywebsite/myappfolder/myapp.exe
    > >
    > > the myappfolder is protected by windows security in IIS and therefore
    > > prompts the user to login. Their login name is not part of a domain and
    > > will
    > > be different from the user name of the machine they are physically
    working
    > > on.
    > >
    > > Once the user has logged in the app is deployed (download to their temp)
    > > to
    > > their machine and run.
    > >
    > > Maybe what I'm looking for isn't possible.
    > >
    > > "Joe Kaplan (MVP - ADSI)" <joseph.e.kaplan@removethis.accenture.com>
    wrote
    > > in message news:OG#$EovCFHA.2288@TK2MSFTNGP14.phx.gbl...
    > >> System.Security.Principal.WindowsIdentity.GetCurrent().Name will return
    > > the
    > >> name of the user that the current thread is executing as. For a
    Windows
    > >> Forms app, that will be the user that launched the process unless your
    > >> app
    > >> is doing some funny impersonation code.
    > >>
    > >> So I think that is what you want if I understand what you are saying.
    > >>
    > >> Joe K.
    > >>
    > >> "Joe" <J_no_spam@_no_spam_Fishinbrain.com> wrote in message
    > >> news:ugMqSLvCFHA.2032@tk2msftngp13.phx.gbl...
    > >> > Thanks but that's not really what I need. I'll try and clarify.
    > >> >
    > >> > The user is not a domain user and has to log onto the machine when
    they
    > >> > attempt to run the program. I have IIS configured without Anonymous
    > > login.
    > >> >
    > >> > When the application runs, I would like to know the name the user
    used
    > >> > when
    > >> > they logged in to run the application. The application needs there
    name
    > > to
    > >> > request additional information about the user from the host machine.
    > >> >
    > >> > "Paul Clement" <UseAdddressAtEndofMessage@swspectrum.com> wrote in
    > > message
    > >> > news:1gj701t0ch5sk97b54f6b6oro7ls7ufunh@4ax.com...
    > >> >> On Fri, 4 Feb 2005 14:17:20 -0500, "Joe"
    > >> > <J_no_spam@_no_spam_Fishinbrain.com> wrote:
    > >> >>
    > >> >> ¤ I have an application being deployed using no-touch deployment.
    The
    > >> > folder
    > >> >> ¤ where the app is requires the user to login using there windows
    > > user/pw
    > >> > in
    > >> >> ¤ order to launch the application.
    > >> >> ¤
    > >> >> ¤ Is there anyway of getting that users name?
    > >> >> ¤
    > >> >>
    > >> >> See if the following works for you:
    > >> >>
    > >> >> Dim DomainUser As String =
    > >> >>
    System.Security.Principal.WindowsIdentity.GetCurrent.Name.Replace("\",
    > >> > "/")
    > >> >> Dim ADEntry As New
    > >> > System.DirectoryServices.DirectoryEntry("WinNT://" & DomainUser)
    > >> >>
    > >> >> Dim FullName As String =
    ADEntry.Properties("FullName").Value
    > >> >>
    > >> >>
    > >> >> Paul ~~~ pclement@ameritech.net
    > >> >> Microsoft MVP (Visual Basic)
    > >> >
    > >> >
    > >>
    > >>
    > >
    > >
    >
    >


  • Next message: Joe Kaplan \(MVP - ADSI\): "Re: Getting Logged in Windows user name"

    Relevant Pages

    • Re: Profile
      ... If the machine was connected tor the domain, you can login also without network connection using the cached credentials on the local machine. ... Is it a standalone server or domain controller? ...
      (microsoft.public.windows.server.general)
    • Re: Configuring networked printer
      ... setup you local machine to use the printer on he remote machine. ... I have now set the "share" advertising checkbox as you suggested, ... On your local machine, you need to have the check box named "Show ... I have done this on Box B and get the following when the server ...
      (Debian-User)
    • RE: Prompt for login credentials using Windows-NT Authentication
      ... If the users log on to the local machine then that is the login tha SQL ... Server expects. ...
      (microsoft.public.sqlserver.server)
    • E2K7 SP1 Rollup6 / W2K8 - IIS Error
      ... I just installed a new E2K7 Server in a remote site and I get the following ... Unable to create Internet Information Services (IIS) directory entry. ... local machine name:xxxxxxx ...
      (microsoft.public.exchange.setup)
    • Re: XP PRO on 2003 Domain
      ... > when you attempt to open it the local machine just hangs for a long time ... > Also is there a setting on server that will allow ... AD-integrated) DNS server's IP address in their network settings. ... DNS server IPs should be 'seen' by servers or clients in their ipconfig /all ...
      (microsoft.public.windows.server.networking)