Click here to Skip to main content
15,899,313 members
Home / Discussions / C#
   

C#

 
GeneralMS Access Pin
waheed awan15-Jan-08 8:11
waheed awan15-Jan-08 8:11 
GeneralRe: MS Access Pin
Dave Kreskowiak15-Jan-08 9:25
mveDave Kreskowiak15-Jan-08 9:25 
GeneralRe: MS Access Pin
Dan Neely15-Jan-08 10:48
Dan Neely15-Jan-08 10:48 
Questionxmlns validate with regex problem Pin
two_man_only15-Jan-08 8:05
two_man_only15-Jan-08 8:05 
AnswerRe: xmlns validate with regex problem Pin
Shimmy Weitzhandler17-Jan-08 8:02
Shimmy Weitzhandler17-Jan-08 8:02 
GeneralRe: xmlns validate with regex problem Pin
two_man_only17-Jan-08 8:21
two_man_only17-Jan-08 8:21 
GeneralGet Current User From Windows Service Pin
Lash2015-Jan-08 5:53
Lash2015-Jan-08 5:53 
GeneralRe: Get Current User From Windows Service Pin
Justin Perez16-Jan-08 3:48
Justin Perez16-Jan-08 3:48 
Lash20 wrote:
I have a windows service running as LOCAL SYSTEM, I need to get the login name of the current user, I have tried WindowsIdentity.GetCurrent().Name and Environment.UserName but they return NT AUTHORITY/SYSTEM which is the name the windows service is running as. Can anyone tell me how to get the login name of the current user. Any help will be GREATLY appreciated..


This is the method I use to do what you are talking about. It does what you were trying to do with WindowsIdentity.GetCurrent().Name. I would be willing to bet that it isn't working because the process you are calling from is a service running on local system. Run it from a windows process and I bet it works.

public static string getCurrentUsernameAndDomain()
{
  WindowsIdentity user = WindowsIdentity.GetCurrent();
  return user.Name;
}


I'm going to become rich when I create a device that allows me to punch people in the face over the internet.

"If an Indian asked a programming question in the forest, would it still be urgent?" - John Simmons / outlaw programmer

GeneralDataTable Suggestion Please [modified] Pin
doubleas238015-Jan-08 5:09
doubleas238015-Jan-08 5:09 
GeneralRe: DataTable Suggestion Please Pin
Not Active15-Jan-08 5:37
mentorNot Active15-Jan-08 5:37 
Generalremoting and window service Pin
poqeqw15-Jan-08 4:41
poqeqw15-Jan-08 4:41 
GeneralRe: remoting and window service Pin
led mike15-Jan-08 4:46
led mike15-Jan-08 4:46 
Generalcustome Components Icon Pin
Abhijit Jana15-Jan-08 4:00
professionalAbhijit Jana15-Jan-08 4:00 
GeneralRe: custome Components Icon Pin
Judah Gabriel Himango15-Jan-08 11:27
sponsorJudah Gabriel Himango15-Jan-08 11:27 
GeneralRe: custome Components Icon Pin
Abhijit Jana15-Jan-08 18:11
professionalAbhijit Jana15-Jan-08 18:11 
GeneralEditing and Printing an word document Pin
Matjaz-xyz15-Jan-08 3:57
Matjaz-xyz15-Jan-08 3:57 
GeneralRe: Editing and Printing an word document Pin
martin_hughes15-Jan-08 4:12
martin_hughes15-Jan-08 4:12 
GeneralRe: Editing and Printing an word document Pin
Matjaz-xyz15-Jan-08 4:42
Matjaz-xyz15-Jan-08 4:42 
QuestionMonthCalendar Pin
Scotty15-Jan-08 3:14
Scotty15-Jan-08 3:14 
GeneralRe: MonthCalendar Pin
Pete O'Hanlon15-Jan-08 3:43
mvePete O'Hanlon15-Jan-08 3:43 
GeneralRe: MonthCalendar Pin
Scotty15-Jan-08 3:58
Scotty15-Jan-08 3:58 
Generaldownloading a file from an url to the server Pin
I Never Look Behind15-Jan-08 3:00
I Never Look Behind15-Jan-08 3:00 
GeneralRe: downloading a file from an url to the server Pin
Not Active15-Jan-08 3:15
mentorNot Active15-Jan-08 3:15 
GeneralCan't find XML file Error Pin
NewToAspDotNet15-Jan-08 1:22
NewToAspDotNet15-Jan-08 1:22 
GeneralRe: Can't find XML file Error Pin
Luc Pattyn15-Jan-08 1:32
sitebuilderLuc Pattyn15-Jan-08 1:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.