Also discussed in ASP.NET to operate IIS

zhaozj2021-02-16  47

I use ASP.NET to write IISVDIR.DLL operation IIS How to use: DIM TEST AS New Iisvdir () Test.createvirtualdir ("LocalHost", "Vdir", "E: /", "Test") Note: 1 The TEST must exist in the web directory. When this code is used in the web, the error cannot be created in the Active component, modify "x: /winnt/microsoft.net/framework/v1.0.3705/config/machine.config"

Imports SystemImports ActiveDsimports Microsoft.VisualBasicNamespace Iisvpath

Public Class Iisvpath

REM create an FTP directory 'ComputerName FTP server name (can be localhost)' DirName to establish a virtual directory name 'true path Function LinkAddr the virtual directory CreateFTPDir (ByVal ComputerName As String, _ ByVal DirName As String, ByVal LinkAddr As String) As boolean try CreateFTPDir = True Dim wWWServer, WWWServer1 As ActiveDs.IADs Dim WWWVirtualDir, WWWIF As ActiveDs.IADs Try WWWIF = GetObject ( "IIS: //" & ComputerName & "/ MSFTPSVC / 1 / Root") Try WWWIF.delete ( " IISFtpVirtualDir ", DirName) Catch End Try Catch End Try WWWServer1 = GetObject (" IIS: // "& ComputerName &" / MSFTPSVC / 1 ") wWWServer = WWWServer1.GetObject (" IIsFtpVirtualDir "," Root ") WWWVirtualDir = WWWServer.Create ("IisftPvirtualdir", Dirname) wwwvirtualdir.path = linkaddr wwwvirtualdir.accessread = true Wwwvirtualdir.accesswrite = false wwwvirtualdir.setInfo () createftpdir = true catch createftpdir = false end end function

REM create a virtual directory program 'ComputerName WEB server name (can be localhost)' 'real path LinkAddr the virtual directory' DirName to establish a virtual directory name WWWSiteName site name Function CreateVirtualDir (ByVal ComputerName As String, _ ByVal DirName As String, ByVal LinkAddr As String, _ ByVal WWWSiteName As String) As Boolean Try CreateVirtualDir = True Dim wWWServer, WWWServer1 As ActiveDs.IADs Dim WWWVirtualDir, WWWIF As ActiveDs.IADs Try Try WWWIF = GetObject ( "IIS: //" & ComputerName & "/ W3SVC / 1 / root / "& wwwsitename) Try wwwif.delete (" IisWebVirtualDir ", DirName) catch end catch end wwwserver1 = getObject (" IIS: // "& Computername &" IIS: // ") WWWServer = WWWSERVER1. GetObject ("IisWebVirtualdir", "root") wwwvirtualdir = wwwserver.create ("IisWebVirtualDir", wwwsitename & "/" & dirname) WWWVirtualDir.Path = LinkAddr WWWVirtualDir.AccessRead = True WWWVirtualDir.AccessScript = True WWWVirtualDir.SetInfo () CreateVirtualDir = True Catch End Try Catch CreateVirtualDir = False End Try End FunctionEnd Class

End Namespace

转载请注明原文地址:https://www.9cbs.com/read-23159.html

New Post(0)