简体   繁体   English

c#.net中的用户模拟问题

[英]User Impersonation issue in c#.net

I am writing ac#.net application to execute certain functions under another user context (on the local system). 我正在编写ac#.net应用程序,以在另一个用户上下文(在本地系统上)下执行某些功能。 I am using the WinAPI " LogonUser(String lpszUsername, String lpszDomain, String lpszPassword, int dwLogonType, int dwLogonProvider, out IntPtr phToken) " for achieving this. 我正在使用WinAPI“ LogonUser(String lpszUsername,String lpszDomain,String lpszPassword,int dwLogonType,int dwLogonProvider,out intPtr phToken) ”实现此目的。

Now the problem that I encounter is, I have a local user in my system who does not have any password. 现在,我遇到的问题是,我的系统中有一个本地用户,该用户没有任何密码。 The above LogonUser fails when I give lpszPassword as null or "". 当我将lpszPassword设置为null或“”时,上述LogonUser失败。 All the resources in the internet about "LogonUser" assumes it is taking a password. 互联网上有关“ LogonUser”的所有资源均假定其正在使用密码。 So I couldn't get any help. 所以我没有任何帮助。 Please help me to figure out a way. 请帮助我找出一种方法。

Thank you, 谢谢,

Aron Sajan Philip 阿隆·萨扬·菲利普(Aron Sajan Philip)

Using this WinAPI interface requires that the user have a password. 使用此WinAPI界面要求用户输入密码。 There are a few examples of software that shows us this, LogMeIn being the most prominent I can think of. 有一些软件示例向我们展示了这一点,LogMeIn是我能想到的最突出的例子。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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