You can use Microsoft.Web.Administration namespace to create a binding and set the certificate hash. Let us say you are trying to add a new binding to a website “MySite” with a new SSL certificate hash “MyCertHash”, here is what you have to do to achieve this
ServerManager serverManager = new ServerManager(); serverManager.Sites["MySite"].Bindings.Add("*.443:", MyCertHash, "MyCert");
The bindings member configures binding information for an IIS 7.0 Web site. You can also add multiple bindings to a website or use similar approach to add other bindings.
- No comments
- Tags: .Net, IIS7, Microsoft, Windows
