生成的线程是否以用户的身份自动运行?

发布于 2024-08-18 13:26:32 字数 218 浏览 3 评论 0原文

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

内心激荡 2024-08-25 13:26:32

是的,他们确实这么做了。

// So yes, you can.

Yes, they do.

// So yes, you can.
治碍 2024-08-25 13:26:32

线程没有身份,进程有。所以是的。

编辑:正如迈克尔指出的那样,线程的执行上下文可能会模拟拥有当前进程的用户以外的用户。但除非你明确地这样做,否则这不会发生。

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.

往事风中埋 2024-08-25 13:26:32

是的。事实上,需要付出一些努力才能使线程能够以不同的用户身份访问资源。

Yes. In fact, it would take some effort to make the Thread able to access resources as a different user.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文