生成的线程是否以用户的身份自动运行?
IE
static void Main(string[] args)
{
var thread = new Thread(WhoAmI);
thread.Start();
}
static void WhoAmI()
{
//can i access network resources as the user who ran Main?
}
ie
static void Main(string[] args)
{
var thread = new Thread(WhoAmI);
thread.Start();
}
static void WhoAmI()
{
//can i access network resources as the user who ran Main?
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
是的,他们确实这么做了。
Yes, they do.
线程没有身份,进程有。所以是的。
编辑:正如迈克尔指出的那样,线程的执行上下文可能会模拟拥有当前进程的用户以外的用户。但除非你明确地这样做,否则这不会发生。
Threads don't have identity, processes do. So yes.
Edit: As Michael points out, it is possible for a thread's execution context to impersonate a user other than the one that owns the current process. But this will not happen unless you do it explicitly.
是的。事实上,需要付出一些努力才能使线程能够以不同的用户身份访问资源。
Yes. In fact, it would take some effort to make the Thread able to access resources as a different user.