萬盛學電腦網

 萬盛學電腦網 >> 網絡編程 >> .net編程 >> VB.NET創建虛擬目錄應用方法介紹

VB.NET創建虛擬目錄應用方法介紹

class="area">

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

VB.NET創建虛擬目錄代碼示例:

  1. Function CriaDiretorioVirtual(ByVal
    vdirname As String, ByVal serverID As
    String, ByVal vdirPath As String,
    ByVal criaApplication As Boolean)
    As DirectoryEntry
  2. Dim newvdir As DirectoryEntry
  3. Dim root As DirectoryEntry
  4. root = New DirectoryEntry("IIS://
    localhost/W3SVC/" + serverID + "/Root")
  5. newvdir = root.Children.Add
    (vdirname, "IIsWebVirtualDir")
  6. newvdir.Properties("Path")(0) =
    vdirPath
  7. If criaApplication Then
  8. newvdir.Invoke("AppCreate", True)
  9. newvdir.Properties("AppFriendlyName")
    (0) = vdirname
  10. newvdir.Properties("AppIsolated")(0) = 2
  11. End If
  12. newvdir.CommitChanges()
  13. Return newvdir
  14. End Function

VB.NET創建虛擬目錄的相關操作方法就為大家介紹到這裡。

copyright © 萬盛學電腦網 all rights reserved