Ik heb het volgende stukje code:
Nou snap ik niet helemaal hoe dat werkt met die bindingsarray. Ik weet niet OF het kan maar ik wil bij die SiteDefinition.Create in de variabele BindingsArray meerdere bindings mee kunnen geven. Iemand? Ik heb van die variabele BindingsArray zelf een array geprobeerd te maken maar dat werkt niet helemaal zoals ik wil.
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
| Dim strSiteName As String, strPhysicalPath As String, DomeinnaamZonderExtensie As String
Dim LokatiePunt As Byte
Dim BindingsArray(2)
strSiteName = "test.nl"
strPhysicalPath = "D:\Websites\" & strSiteName
Dim objFSO As New Scripting.FileSystemObject
If Not objFSO.FolderExists(strPhysicalPath) Then objFSO.CreateFolder (strPhysicalPath)
If Not objFSO.FolderExists(strPhysicalPath & "\www") Then objFSO.CreateFolder (strPhysicalPath & "\www")
If Not objFSO.FolderExists(strPhysicalPath & "\database") Then objFSO.CreateFolder (strPhysicalPath & "\database")
Set objFSO = Nothing
LokatiePunt = InStr(strSiteName, ".")
DomeinnaamZonderExtensie = Left(strSiteName, LokatiePunt - 1)
Dim oService As WbemScripting.SWbemServicesEx
Set oService = GetObject("winmgmts:root\WebAdministration")
Set SiteBinding = oService.Get("BindingElement").SpawnInstance_
SiteBinding.BindingInformation = "*:80:" & strSiteName
SiteBinding.Protocol = "http"
BindingsArray(0) = Array(SiteBinding)
Set SiteBinding = Nothing
Set SiteBinding = oService.Get("BindingElement").SpawnInstance_
SiteBinding.BindingInformation = "*:80:www." & strSiteName
SiteBinding.Protocol = "http"
BindingsArray(1) = Array(SiteBinding)
Set SiteBinding = Nothing
Set SiteBinding = oService.Get("BindingElement").SpawnInstance_
SiteBinding.BindingInformation = "*:80:www." & DomeinnaamZonderExtensie & ".it"
SiteBinding.Protocol = "http"
BindingsArray(2) = Array(SiteBinding)
Set SiteBinding = Nothing
Set SiteDefinition = oService.Get("Site")
SiteDefinition.Create strSiteName, BindingsArray(0), strPhysicalPath
Set SiteDefinition = Nothing
Set oService = Nothing |
Nou snap ik niet helemaal hoe dat werkt met die bindingsarray. Ik weet niet OF het kan maar ik wil bij die SiteDefinition.Create in de variabele BindingsArray meerdere bindings mee kunnen geven. Iemand? Ik heb van die variabele BindingsArray zelf een array geprobeerd te maken maar dat werkt niet helemaal zoals ik wil.
Not all chemicals are bad. Without hydrogen or oxygen, for example, there would be no way to make water, a vital ingredient in beer.