I am writing a program in c# that creates a process of google chrome in incognito mode. Everything goes good. I want to start the process and after 2 seconds to kill it(and close the chrome window).
String a = textBox1.Text + " --incognito";//Get the link that the user types
process.StartInfo.FileName = @"C:\Program Files (x86)\Google\Chrome\Application\chrome";
process.StartInfo.Arguments =a;
process.Start();
System.Threading.Thread.Sleep(2000);
process.Kill();
It gives me an error that: Cannot process request because the process has exited.
and the break point is in the process.Kill(); line.