| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 
 | Public Sub CreateWebsite(ByVal serverComment As String, ByVal serverBindings As String, ByVal homeDirectory As String)
        Dim w3svc As DirectoryEntry
        Dim newsite() As Object
        Dim websiteId As Object
 
        w3svc = New DirectoryEntry("IIS://localhost/w3svc")
        newsite = New Object() {serverComment, New Object() {serverBindings}, homeDirectory}
 
        Try
            websiteId = w3svc.Invoke("CreateNewSite", newsite)
        Catch ex As Exception
' **********************************************
' Je cherche à récupérer l'identifiant du site WEB existant
' **********************************************
            websiteId = ???
            w3svc = New DirectoryEntry("IIS://localhost/w3svc/" & websiteId & "/")
            w3svc.Path = homeDirectory
            w3svc.CommitChanges()
        End Try
    End Sub | 
Partager