[英]C# Start Process with logged on user credentials
我正在运行具有提升的用户权限的Winforms应用程序(作为不同的域管理员帐户模拟运行方式),但是我想启动一个子进程,将Web浏览器打开到具有当前登录用户权限的URL,而不是没有提升权限的提升权限必须提示他们输入密码和登录信息,以便NTLM与当前登录的用户权限正确握手。
我已经尝试过类似的东西:
// I have the USER NAME, this is not the issue
// I have the Domain, this is not the issue
// I need to grab the Password from the currently logged on user
// without prompting for it
System.Security.SecureString oPass = new System.Security.SecureString();
System.Diagnostics.Process.Start("IExplore.exe"
, this.oConfiguration.WrappersURL
, this.WindowsUserID
, oPass
, this.DomainName
);
..但我不太确定如何获取用户密码。 关于如何减少与W7和XP兼容的登录用户的衍生进程的权限的任何想法?
获取当前用户并以这种方式启动它:
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.UserName = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
Process.Start(startInfo);
您要获取DomainName和UserName,请执行以下操作
编辑:
var userNameSplit = System.Security.Principal.WindowsIdentity.GetCurrent().Name.Split('\\');
var userDomain = userNameSplit[0];
var userName = userNameSplit[1];
似乎没有办法在Windows中执行此操作,因此我通过执行以下操作解决了这一难题:
丑陋,骇人听闻,有点令人费解,但这就是企业安全性:D
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.