Anyone know how to modify an IIS6 configuration from software? (vbscript/c#). I need to add and remove host headers on a site in code (nothing else!) I'm modifying my CMS engine to support subdomains as part of the site's content heirarchy.
Anyone know how to modify an IIS6 configuration from software? (vbscript/c#). I need to add and remove host headers on a site in code (nothing else!) I'm modifying my CMS engine to support subdomains as part of the site's content heirarchy.
To add host headers:Originally Posted by cswd
Code:Dim oIIS, NewBindings, NewBinding, Bindings Set oIIS = GetObject("IIS://LOCALHOST/W3SVC/1/ROOT") ' Construct the new Server Bindings NewBindings = Array("") NewBinding = "IPADDRESS:PORT:HEADERNAME" ' Create an array of the current Server Bindings Bindings = oIIS.ServerBindings ' Populate NewBindings and remove the new Server Binding if it already exists For i = LBound(Bindings) To UBound(Bindings) If Bindings(i) <> NewBinding Then NewBindings(UBound(NewBindings)) = Bindings(i) ReDim Preserve NewBindings(UBound(NewBindings) + 1) End If Next i ' Add the new Server Binding to NewBindings NewBindings(UBound(NewBindings)) = NewBinding ' Update IIS oIIS.ServerBindings = Bindings oIIS.SetInfo Set oIIS = Nothing
Warren Ashcroft
Red Fox UK Limited - Pioneers in Internet Technology
http://www.redfoxuk.com
w.ashcroft [at] redfoxuk.com
NOTE: Forum Private Messaging should not be used to contact staff with support queries.
Fantastic! Thank you very very very much
I'll try it later after I've got my dose of McGrease.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks