How to Impersonate a user in managed code?

前端 未结 5 1967
逝去的感伤
逝去的感伤 2020-12-09 00:29

Given a username and password how do i impersonate that user and run some code as that user.

And by managed i mean without pinvokes or dllimports

5条回答
  •  没有蜡笔的小新
    2020-12-09 01:18

    There's a similar question with a great answer here.

    Have a look at WindowsImpersonationContext for some more information (also there's another great code sample there)

提交回复
热议问题