I was wondering if someone could help. I have a scenario where I am
trying to set up multiple host headers on a web site using ADSI. Ex: I
have a site called www.testsite.com to which I want to assign three
host headers like (testsite.com, 123.testsite.com, and testsite). My
script creates the site and sets several properties just fine.
However, when I check the host headers, there is only one entry with
all the three host headers I specified as a concatenated string and
delimited with a comma.


I would appreciate any help.
Thanks,
Max.

Here is the code I use to setup the ServerBindings for the site. By
the way, this is the same script from IISFaq.com by Chris Crowe:

HostNames = Split("testsite.com,123.testsite.com,testsite", ",")
IpAddress = 199.12.1.50
Port = 80
redim NewBindings (ubound(HostNames))

For HostNameINdex = 0 To UBound(HostNames)
BindingString = IpAddress & ":" & PortNum &
":"&HostNames(HostNameIndex)
NewBindings(HostNameINdex) = BindingString
next
'Set the server bindings by passing it the NewBindings array.
NewWebServer.ServerBindings = NewBindings

Re: Adding multiple host headers through ADSI not working properly by David

David
Wed Nov 26 01:27:22 CST 2003

Is that the actual and entire code snippet?

- You can't declare a variable like IpAddress
- PortNum is not declared properly
- Where is the definition of NewBindings
- Where is the SetInfo?

The code worked for me once I cleaned up all the errors.

--
//David
IIS
This posting is provided "AS IS" with no warranties, and confers no rights.
//
"Max" <mlamriben@yahoo.com> wrote in message
news:d7eb831c.0311251958.3728baed@posting.google.com...
I was wondering if someone could help. I have a scenario where I am
trying to set up multiple host headers on a web site using ADSI. Ex: I
have a site called www.testsite.com to which I want to assign three
host headers like (testsite.com, 123.testsite.com, and testsite). My
script creates the site and sets several properties just fine.
However, when I check the host headers, there is only one entry with
all the three host headers I specified as a concatenated string and
delimited with a comma.


I would appreciate any help.
Thanks,
Max.

Here is the code I use to setup the ServerBindings for the site. By
the way, this is the same script from IISFaq.com by Chris Crowe:

HostNames = Split("testsite.com,123.testsite.com,testsite", ",")
IpAddress = 199.12.1.50
Port = 80
redim NewBindings (ubound(HostNames))

For HostNameINdex = 0 To UBound(HostNames)
BindingString = IpAddress & ":" & PortNum &
":"&HostNames(HostNameIndex)
NewBindings(HostNameINdex) = BindingString
next
'Set the server bindings by passing it the NewBindings array.
NewWebServer.ServerBindings = NewBindings