VB.NET編程語言可以幫助我們實現許多功能,比如對移動設備的操作,對數據庫的操作,對圖形界面的處理以及對文件文本的操作等等。我們今天將要學到的則是VB.NET創建虛擬目錄的方法,希望能給大家帶來一些幫助。
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
VB.NET創建虛擬目錄的相關操作方法就為大家介紹到這裡。