当前位置:编程问答 > VB >

一个老外写的创建虚拟目录(VB.net)

Function CriaDiretorioVirtual(ByVal vdirname As String, ByVal serverID As String, ByVal vdirPath As String, ByVal criaApplication As Boolean) As DirectoryEntry
        Dim newvdir As DirectoryEntry
        Dim root As DirectoryEntry
 
        root = New DirectoryEntry("IIS://localhost/W3SVC/" + serverID + "/Root")
 
        newvdir = root.Children.Add(vdirname, "IIsWebVirtualDir")
        newvdir.Properties("Path")(0) = vdirPath
 
        If criaApplication Then
            newvdir.Invoke("AppCreate", True)
            newvdir.Properties("AppFriendlyName")(0) = vdirname
            newvdir.Properties("AppIsolated")(0) = 2
        End If
        newvdir.CommitChanges()
 
        Return newvdir
    End Function

补充:Web开发 , ASP.Net ,
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,