Here is the ASP source code used to display the banner ads page (ADSAMPLE.ASP):

<HTML>
<HEAD>
<TITLE>Banner ads sample</TITLE>
<META HTTP-EQUIV="REFRESH" CONTENT=5>
</HEAD>
<BODY>

<% Set Ad = Server.CreateObject("MSWC.Adrotator") %>
<%= Ad.GetAdvertisement("adrot.txt") %>

</BODY>
</HTML>

The call to CreateObject creates the Ad Rotator component. Calling the GetAdvertisement method of the Ad Rotator inserts the next ad image in the rotation, by reading the rotator schedule file, ADROT.TXT.

Here are the contents of ADROT.TXT:

redirect adredir.asp
width 468
height 60
border 1
*
SBNwk3.gif
http://www.microsoft.com/sitebuilder
banner ad
2
sbnwk1.gif
http://www.microsoft.com/sitebuilder
banner ad
2
SBN2VBtest.GIF
http://www.microsoft.com/sitebuilder
banner ad
1
SBN1test4.gif
http://www.microsoft.com/sitebuilder
banner ad
3
DEBUGANI.GIF
http://www.microsoft.com/sitebuilder
banner ad
1

The entries above list the different ad images, the URL to jump to when they are clicked, alternate text for them, and their weighting relative to one another. In the redirect file (in this sample named ADREDIR.ASP), you can do anything you want, like record the clicks on the ad in a log file. This sample creates an HTML page containing client JavaScript to open up a new browser window with the URL associated with the ad.

Here are the contents of ADREDIR.ASP:

<HTML>
<SCRIPT LANGUAGE=JavaScript>
<!--
    window.open('<%= request.QueryString("url") %>', 'new_window');
// -->
</SCRIPT>
</HTML>

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