Reputation: 83
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.
Upvotes: 8
Views: 8587
Reputation: 53
If you open task manager, you will see the process owner in the "User Name" collumn.
Upvotes: 2
Reputation: 18420
Any application run without specifying a specific user (Run as...) runs under default logged in user's context.
Upvotes: 1
Reputation: 83358
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.
Upvotes: 7
Reputation: 498904
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.
Upvotes: 3