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.
You will need three files (not including your ad images) to program this feature:
2. This page: adrotator.asp
3. A page to send the user to the URL of the ad: adredir.asp
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:
redirect adredir.asp width 468 height 60 border 0 * ../images/banner1.gif http://www.frontpagehowto.com FrontPageHowTo.com – Tips and tricks for FrontPage! 1 ../images/banner2.gif http://www.frontpagehowto.com FrontPageHowTo.com – Tips and tricks for FrontPage! 1 ../images/banner3.gif http://www.frontpagehowto.com FrontPageHowTo.com – Tips and tricks for FrontPage! 1
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")) %>
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") %>