Wednesday, 10 September 2008

WatiN - Running IISReset

There might be ocassion where there's a need to run an IISReset as part of your Test. Here's how you do it.

// Run IIS reset to clear the chache
Process iisResetProcess = System.Diagnostics.Process.Start("cmd.exe", ConfigurationManager.AppSettings["iisResetCommand"].ToString());

In order to allow this to work, please ensure that your App.Config has the following within appSettings.

<add key="iisResetCommand" value="/C iisreset MACHINE NAME"/>

Thanks to David Cromar

No comments: