AdServer Object Overview

The AdServer object is usually created in the Application_OnStart function defined in the Global.asa file. Use the Active Server Pages (ASP) Server object’s CreateObject method to create an AdServer object. In addition, properties of this object can be set in Global.asa:

'  Create the AdServer object
Set  Ad = Server.CreateObject("Commerce.AdServer") 

Ad.ConnectionString = “DSN=adsamples;UID=sa;PWD=;”   

'  Set AdServer properties
Ad.DefaultAd = "<B><FONT SIZE=+4 COLOR=BLUE><MARQUEE WIDTH=400>This is the default ad</MARQUEE></FONT></B>"
Ad.RefreshInterval = 900
Ad.RetryInterval = 60
Ad.RedirectURL = "/adsamples/adredir.asp"
Ad.DesignMode = False
Ad.Application = "clocktower"

Also in Global.asa, store the new object in the Application object, as follows:

Set Application("Ad")  = Ad

Because the AdServer object is marked "both" under threading model, it has been designed to be "thread safe" and can be given application scope and used by ASP pages at any time without fear of data loss or collision.


© 1997-1998 Microsoft Corporation. All rights reserved.