Create an Adrotator

In this example we will create an adrotator using the Ad rotator component . We will show you the code in this example , in a future exercise we will explain in more detail all about using the Adrotator component.

Step 1 :

Save the following as adrotator.txt , create 3 gifs 480 by 60 called 02 , 03 and 04

***
REDIRECT adRedirect.php
WIDTH 480
HEIGHT 60
BORDER 0
*
http://asp.myscripting.com/02.gif
http://asp.myscripting.com
Visit asp.myscripting.com
20
http://asp.myscripting.com/03.gif
http://vbscript.myscripting.com
visit VBScript site now
40
http://asp.myscripting.com/04.gif
http://javascript.myscripting.com
Javascript resource site
40
***

Step 2 :

Create your redirect file , in this case adRedirect.php and enter the following

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

Step 3 :

Put this code on the pages you wish the banner to be displayed

<%
Dim objAdRotator
'create an instance of adrotator
Set objAdRotator = Server.CreateObject("MSWC.AdRotator")
'get the ad from the file
Response.Write objAdRotator.GetAdvertisement("adrotator.txt")
'destroy the object
Set objAdRotator = Nothing
%>

 

Books

cover

Professional Active Server Pages 3.0

cover

Beginning ASP Databases

cover

ASP in a Nutshell: A Desktop Quick...