Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. HOWTO Gather current user name from win service ?

HOWTO Gather current user name from win service ?

Scheduled Pinned Locked Moved C#
securityhelpquestionworkspace
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Alper Camel
    wrote on last edited by
    #1

    Hi all dear friends, I have a win. service, and I try to read the current user name, the following methods DONT work, please help. 1. Way : --> System.Security.Principal.WindowsIdentity.GetCurrent().Name; 2. Way : --> Environment.UserName; these are dont work, becuase, win service run as a account "system" default. any other ideas ? Cheers...

    C 1 Reply Last reply
    0
    • A Alper Camel

      Hi all dear friends, I have a win. service, and I try to read the current user name, the following methods DONT work, please help. 1. Way : --> System.Security.Principal.WindowsIdentity.GetCurrent().Name; 2. Way : --> Environment.UserName; these are dont work, becuase, win service run as a account "system" default. any other ideas ? Cheers...

      C Offline
      C Offline
      Colin Angus Mackay
      wrote on last edited by
      #2

      Alper Sümer Güç wrote:

      these are dont work, becuase, win service run as a account "system" default

      Actually, that is showing the correct result. The current user IS "System". Each process running runs in its given security context and as far as the application is concerned that is the current user.


      Upcoming Scottish Developers events: * UK Security Evangelists On Tour (2nd November, Edinburgh) * Developer Day Scotland: are you interested in speaking or attending? My: Website | Blog

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups