protected void Button2_Click(object sender, EventArgs e) { var server = new ServerManager(); var site = server.Sites.FirstOrDefault(s => s.Name == "chinna"); if (site != null) { //stop the site... site.Stop(); if (site.State == ObjectState.Stopped) { Button1.Text = "website stopped"; } else { throw new InvalidOperationException("Could not stop website!"); } //restart the site... site.Start(); Button1.Text = "web site started"; } else { throw new InvalidOperationException("Could not find website!"); } }
foreach (Site site in IIS.Sites) { //Console.WriteLine(String.Concat //( // site.Name, " , ", // site.Id, " , ", // //site.State, " , ", // site.Applications["/"].VirtualDirectories[0].PhysicalPath //)); Console.WriteLine(site.Name.ToString());
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)