简体   繁体   中英

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

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 ac# 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.

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.

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.

如果您打开任务管理器,您将在“用户名”列中看到进程所有者。

在未指定特定用户的情况下运行的任何应用程序(运行方式...)都在默认登录用户的上下文中运行。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM