Previous in Contents Next in Contents

AdminWebServer Object Overview

The following example enumerates all the Web sites on a server and displays the number of each server instance. Then for each Web site, it obtains the site properties and displays the VrPath property. Finally, for each Web site, it enumerates all the Commerce Server sites within that Web site, and displays the virtual directory for each Commerce Server site:

<%
' Create AdminWebServer object
Set objWebServer = CreateObject("Commerce.AdminWebserver")
    
' Get Web sites
WebSites = objWebServer.GetWebSites
For WebInstance = LBound(WebSites, 1) To UBound(WebSites, 1)
        
    ' Print instance number of web site
    Response.Write "<h3>Server Instance " + WebSites(WebInstance) + "</h3>"

    ' Return its properties in a dictionary
    Set objDict = objWebServer.GetWebSiteProperties(WebSites(WebInstance))

    ' Enumerate and display the dictionary
   for each property in objDict
      response.write  property & " = " & objDict.value(property) & "<br>" 
    next

   ' For each web site, get all Commerce sites in an array of instances
        CommerceSites = objWebServer.GetCommerceSites(WebSites(WebInstance))
        
   ' Enumerate all Commerce sites
      For CSite = LBound(CommerceSites, 1) To UBound(CommerceSites, 1)
         Response.Write "<br>" + CommerceSites(CSite)
      Next
 Next

' Destroy objects
Set objDict = Nothing
Set objWebServer = Nothing
%>

Note  Active Server Pages (ASP) scripts that access the Microsoft® Internet Information Server (IIS) metabase require administrator privileges on the computer on which IIS is running. When you execute these scripts from a remote computer, you must connect through a secure connection, such as the Microsoft® Windows NT® Challenge/Response Authentication method. It is suggested that you create a server or directory for your administrative .asp files and set the directory security authentication method to Windows NT Challenge/Response for the server or directory.


© 1997-2000 Microsoft Corporation. All rights reserved.