Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
I need to restart IIS 6.0 on button click from C# programming in asp.net 2.0. I am trying to do this using C# code. I have seen some similar questions about restarting IIS through code. But I have not been able to get any working solution from it. Some clearcut C# code about how to do the restart operations would be really helpful.
Posted

 
Share this answer
 
 
Share this answer
 
v2
You could try:
C#
// using ...
using System.Diagnostics;

public class YourForm : Form
{
   // ...

   private void yourButton_Click(object sender, EventArgs e)
   {
      Process.Start(@"C:\WINDOWS\system32\iisreset.exe", "/noforce");
   }

   // ...
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900