This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void ChangeSiteBinding(string siteName, string newBindingValue, string protocol) | |
{ | |
using (ServerManager manager = new ServerManager()) | |
{ | |
// Find the site by name from IIS | |
Microsoft.Web.Administration.Site site = manager.Sites.Where(q => q.Name == siteName).FirstOrDefault(); | |
if (site == null) | |
{ | |
throw new Exception("The specified site name does not exist in IIS!"); | |
} |