title: Turn Firewall on and off of using C#
body: <p>I have written a C# program that uses command line arguments to 
  turn the firewall on and off.</p>
  
  <pre><code>Process proc = new Process();
  string top = "netsh.exe";
  proc.StartInfo.Arguments = "**Advfirewall set allprofiles state on**";
  proc.StartInfo.FileName = top;
  proc.StartInfo.UseShellExecute = false;
  proc.StartInfo.RedirectStandardOutput = true;
  proc.StartInfo.CreateNoWindow = true;
  proc.Start();
  proc.WaitForExit();
  // MessageBox.Show("Disable");
  button1.Text = "Set On";
  status = false;
  </code></pre>
  
  <p>I also run the application with admin permission. The application automatically runs with admin permissions but does not set firewall status on or off.</p>
  
  <p>When I run the same command in cmd(netsh) the firewall is turned on or off.</p>
  
  <p>Does anyone know why this is not working?</p>