2

我使用以下代码创建了一个进程:

Process process = new Process();
// Configure the process using the StartInfo properties.
process.StartInfo.FileName = fileToRun;
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardError = true;
process.StartInfo.Arguments = arguments;
process.StartInfo.Domain = "domainName";
process.StartInfo.UserName = "username";
SecureString ss = new SecureString();
"password".ToCharArray().ToList().ForEach(ss.AppendChar);
process.StartInfo.Password = ss;
process.Start();
//Check if we need to wait for the process to exit
if (waitForExit)
{
    process.WaitForExit();
}

此过程的参数是 http:// 位置,需要用户名和密码。即使我提供了用户名和密码,我仍然会收到 Windows 提示输入凭据。我需要做些什么才能不要求提供凭据吗?

4

0 回答 0