getServer

The getServer method of the AspContext class creates an instance of the Server object.

public static Server getServer();

Example

The following example shows how to obtain an instance of the Server object and call its createObject method to create an instance of a COM component. This example uses the progid of the MSWC.AdRotator component.

import com.ms.iis.asp.*;

public class getservtest

{
  public boolean objcreate()
  {
     Server servMyServ = AspContext.getServer ();
     //Returns OK if the object was created successfully 
        Object objVar = servMyServ.createObject(“MSWC.AdRotator”);
     if (objVar != null)
     {
         return true;
     }
     else
     {
         return false;
     }
     
  }
}

© 1999 Microsoft Corporation. All rights reserved. Terms of use.