Skip to content

Instantly share code, notes, and snippets.

View Jignesh-Darji's full-sized avatar
😃
Working as .Net full stack developer

Jignesh Darji Jignesh-Darji

😃
Working as .Net full stack developer
View GitHub Profile
@Jignesh-Darji
Jignesh-Darji / ChangeIISSiteBinding.cs
Last active March 28, 2018 10:19 — forked from vnisor/gist:42ebcc196ab2d8675df46adfc191242c
How to change bindings on a site in IIS using C#
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!");
}