Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does a C# console app run under current user account?

Tags:

c#

exe

Before I open my big mouth and say it is the default way a console app works in c# I wanted to get a few of you folks opinion.

Essentially, we have a c# console app the create a folder full of files from byte streams. Pretty simple. They now want to have it write directly to a shared drive that only a few people have read/write privilages.

I think that as long as they kick of the exe while logged in as as privelaged user it will copy to the share drive.

Unfortunately, they want this information without creating the folder and share first. sigh b/c that would have been too easy to just test the blasted thing.

like image 573
Chris Avatar asked Feb 09 '11 21:02

Chris


4 Answers

To answer the question in the title of your question, yes, a C# console app runs under whatever account you run it as.

Note, you should be able to right click on the executable and click "run as" or "run as administrator" instead of actually logging on as another user.

I hope I'm not missing the point of your question.

like image 122
Adam Rackis Avatar answered Oct 10 '22 01:10

Adam Rackis


By default, yes, it will run under the logged in user credentials (as would any other application).

Of course, if this is run as a scheduled task, uses the Process class or the runas command, one can specify a different user.

like image 25
Oded Avatar answered Oct 10 '22 01:10

Oded


If you open task manager, you will see the process owner in the "User Name" collumn.

like image 37
Svein Avatar answered Oct 10 '22 01:10

Svein


Any application run without specifying a specific user (Run as...) runs under default logged in user's context.

like image 39
Shekhar_Pro Avatar answered Oct 10 '22 01:10

Shekhar_Pro