Starting Firefox using Process.Start: Firefox not starting when you set Usename and Password

霸气de小男生 提交于 2019-12-12 16:03:24

问题


When I try to start Firefox using Process.Start and ProcessStartInfo (.NET) everything seems to work fine. But when I specify a username and password of another account (a member of Users), nothing seems to happen. The same code works fine with Calc.exe or IE. This is weird. Any ideas?

Here is the code:

System.Diagnostics.ProcessStartInfo pInfo = new System.Diagnostics.ProcessStartInfo();
pInfo.CreateNoWindow = false;
pInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal;
pInfo.WorkingDirectory = "{WorkingDirectory}";
pInfo.Arguments = "{CommandLineArgs}";
pInfo.FileName = "{ExecutableAddress}";
pInfo.ErrorDialog = true;
pInfo.UseShellExecute = false;
pInfo.UserName = "{LimitedAccountUserName}";
pInfo.Password = "{SecureLimitedAccountPassword}";
System.Diagnostics.Process.Start(pInfo);

Thanks everyone.


回答1:


In order to load an application with a different credential, if that app uses the user profile, LoadUserProfile property of the ProcessStartInfo should be set to true.



来源:https://stackoverflow.com/questions/388513/starting-firefox-using-process-start-firefox-not-starting-when-you-set-usename

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!