scriptmaps in IIS
am 08.11.2007 18:22:11 von miguelangelyanezhi from spain and excuse me for my bad english. With this code in vb.net i
create perfectly a site in IIS6, but i have a problem creating "Scriptmaps"
that its a "list" type. I only get the last invoke and i was tryed passing a
array but i get a error. How can i pass a list collection to "Scriptmaps"
thanks
Dim root As DirectoryEntry = New DirectoryEntry("IIS://localhost/W3SVC")
root.AuthenticationType = AuthenticationTypes.Secure
root.Username = "xxxxx"
root.Password = "xxxx"
Dim siteID As Integer = 1
Dim e As DirectoryEntry
For Each e In root.Children
If e.SchemaClassName = "IIsWebServer" Then
Dim ID = Convert.ToInt32(e.Name)
If ID >= siteID Then
siteID = ID + 1
End If
End If
Next
Dim site As DirectoryEntry = CType(root.Invoke("Create", "IIsWebServer",
siteID), DirectoryEntry)
site.Invoke("Put", "ServerComment", "www." + dominio.ToLower.Trim)
site.Invoke("Put", "KeyType", "IIsWebServer")
site.Invoke("Put", "ServerBindings", ":80:www." + dominio.ToLower.Trim)
site.Invoke("Put", "ServerState", 2)
site.Invoke("Put", "FrontPageWeb", 1)
site.Invoke("Put", "DefaultDoc", "default.aspx")
site.Invoke("Put", "ServerAutoStart", 1)
site.Invoke("Put", "ServerSize", 1)
site.Invoke("Put", "AccessScript", 1)
site.Invoke("Put", "AccessRead", 1)
Dim siteVirtualDir As DirectoryEntry = site.Children.Add("Root",
"IISWebVirtualDir")
siteVirtualDir.Invoke("Put", "Path", "c:\webroot\v2.mard.com")
siteVirtualDir.Invoke("Put", "AppFriendlyName", "Default Application")
siteVirtualDir.Invoke("Put", "AppIsolated", 2)
siteVirtualDir.Invoke("Put", "AppPoolId", "aspnet2")
siteVirtualDir.Invoke("Put", "ScriptMaps",
".aspx,c:\windows\microsoft.net\framework\v2.0.50727\aspnet_ isapi.dll,1,GET,HEAD,POST,DEBUG")
siteVirtualDir.Invoke("Put", "ScriptMaps",
".ascx,c:\windows\microsoft.net\framework\v2.0.50727\aspnet_ isapi.dll,1,GET,HEAD,POST,DEBUG")
siteVirtualDir.Invoke("Put", "ScriptMaps",
".asax,c:\windows\microsoft.net\framework\v2.0.50727\aspnet_ isapi.dll,1,GET,HEAD,POST,DEBUG")
siteVirtualDir.CommitChanges()
siteVirtualDir.Invoke("AppCreate", False)
siteVirtualDir.Close()
siteVirtualDir.Dispose()
site.CommitChanges()
root.Close()