开发者

Do spawned threads automatically run as the identity of the user?

ie

static void Main(string[] args)
{
    var thread = new Thread(WhoAmI);
    thread.Start();
}

static void WhoAmI()
{ 
    //can i acces开发者_StackOverflow社区s network resources as the user who ran Main?
}


Yes, they do.

// So yes, you can.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜