I am trying to change the Bindings for my Site through my aspx page. Ex. I have an existing site "BRETT\Sites\MySite" (IIS 7.5) with Site Bindings: Type is "http", Port is "81", and IP Address is "*".
I have looked a few different examples but have been unsuccessful.
I looked at WMI examples but I can't find one that is in C#.
I tried to find a way to access the bindings using:
string iisDirectory = "IIS://BRETT/Sites/MySite";
//string iisDirectory = "C:/ProgramData/Microsoft/Windows/Start Menu/Programs/Administrative Tools/BRETT/Sites/MySite";
DirectoryEntry dir1 = new DirectoryEntry(iisDirectory);
PropertyValueCollection ApplicationMappings = dir1.Properties["Bindings"]; //SiteBindings?
I also tried using some examples here without much luck:
Go to the complete details ...