FrontPageHowTo.com - Tips and tricks for FrontPage!

ASP Ad Rotator...

Use the built in functionality of IIS to rotate ads...
This code will rotate 3 ads at the top of this page randomly as the page is refreshed. If the same ad keeps showing, refresh again.

How To:

You will need three files (not including your ad images) to program this feature:

1. adrot.txt
2. This page: adrotator.asp
3. A page to send the user to the URL of the ad: adredir.asp

adrot.txt

This text file contains the pertinent information on the ad graphic location, the redirection page, image size and graphic relevance. What is this last feature? When you assign a number to an add, it gives it the same, less, or more relevance to other ads. For example, if I set ad 3 to 2, it will get more viewings than the other two. NOTE: This is a random rotator. It does not specify and order to the ad viewings. 

Here is the text for adrot.txt:

adrotator.asp

This ASP page simply calls the Adrotator Object that is part of the server objects collection of IIS. Place these lines of code in the HTML code where you want the ad to be displayed:

<% Set Ad = Server.CreateObject("MSWC.Adrotator")

Response.Write(Ad.GetAdvertisement("adrot.txt")) %>

adredir.asp

This page simply grabs the URL from the query string passed to it when the user clicks on the ad and redirects the browser to that page. Here is the code:

<% Response.Redirect Request.QueryString("URL") %>

 

 

This site was built and is maintained by DJ Web Works.
© 2000. All rights reserved.
Microsoft and FrontPage2000 are registered trade marks of Microsoft Corporation.