I have created one button and on click of button I want to reset my IIS from command prompt in background..
This is how I tried:
namespace Demo
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
var psi = new ProcessStartInfo
{
FileName = "cmd",
WindowStyle = ProcessWindowStyle.Hidden,
UseShellExecute = false,
CreateNoWindow = true,
Arguments = @" /C IISRESET"
};
Process.Start(psi);
}
}
}
It seems like not working. What should be the correct way? I'm Very new in this. Any suggestion would be appreciated.