ASPAlliance Home
Advertise with us
About Prasad KVNM
Refer this Site
                                               
Home Advertisement Management Systems KV's Kool ASP
Search
Samples/Articles
Convert URLs into Hyperlinks

Advertisement Management Systems

AdRotator Component

Extending AdRotator Component

Simple Alternative to AdRotator

A more powerful Ad Management System

Opinion Poll

Suggestions/Snippets
Passing Special Characters through URL

Date delimiter for Access and SQL Server

CDBL instead of CSNG

Handling Database Errors

Avoid Partial Updates to the Database

Book Review
C# and the .NET Platform

Favorite Links
ASPLists.com
ASPNG.com
Computer Dictionary
LearnASP.com

Microsoft .NET
Search @ Google
Wrox Press
Freecode.com

Site by Prasad KVNM,
New Jersey, USA
prasad@kunisetty.com
last updated on
22nd Oct, 2001



AdRotator Component

If you have more than one advertisement, and want to display all those advertisements on top of your page alternatively, you can use AdRotator component.

AdRotator is an intrinsic component of ASP right from ASP version 1.0. This component delivers Advertisements based on information stored in a Text file. This component displays advertisements randomly based on specified percentage.

Implementing an advertisement system using AdRotator component is an easy process. Let's use a sample to understand it very clearly.

First you need to create a plain text file which stores all of your advertisements information. The first four lines of this file are optional, but it is better to mention these lines. This file is called as Rotator Schedule File. 

The following is Rotator Schedule file for our sample:

<!-- Beginning of adRotator.txt file -->

REDIRECT adRedir.asp
WIDTH 468
HEIGHT 60
BORDER 0
*
http://www.aspalliance.com/pkvnm/advt/banners/mybanner.gif
http://www.aspalliance.com
Passionate ASP Experts
30
http://www.telugupeople.com/advt/banners/tpladeng1.gif
http://www.telugupeople.com
Online Directory of Telugus - by KVNM
50
http://www.aspalliance.com/pkvnm/advt/banners/second.gif
http://www.bbcworld.com/
BBC World
20

<!-- End of adRotator.txt file -->

The first four lines in the above text file are parameters for all the advertisements specified in the file.

First line specifies a redirection file, that can be used to track number of clicks advertisement wise. If we specify a redirection file, whenever a user clicks on the advertisement, he/she will be redirected to the specified file along with the URL of the advertisement destination. So, we should again redirect the user to the advertisement destination using a redirection statement in the redirection file.

The following is the redirection file used in our sample.

<!-- Beginning of adRedir.asp file -->

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

<!-- End of adRedir.asp file -->

We will discuss how to track the clicks using this redirection file here.

Second and third lines specifies width and height of the advertisement banner image size in pixels. Note that this size is going to be same of all advertisements specified in this text file. International standard size of banner advertisement is 468 X 60 pixels.

Fourth line specifies the border size in pixels for the banner advertisement.

After the fourth line, there is an asterik (*) symbol, which is mandatory in the text file, whether we specify the first four lines or not.

Then actual advertisement information will start. For each advertisement, we have to specify:

1. The advertisement banner image location (URL)
2. The destination of the advertisement - when you click on it (URL)
3. Alternate text for the advertisement banner image
4. Percentage of the time for this advertisement to display. This is a numeric value between 1 to 100. For all the advertisements put together, it should be 100. In our sample, there are three advertisements. The first advertisement has a value of 30. Second 50 and third 20. So, second advertisement gets displayed half of the time., i.e., more number of times than the other two. Second advertisement is displayed 30 percent of the time and the third one will have a least 20 percent time.

Now let's look at the sample ASP file that implements the AdRotator component.

<!-- Beginning of the adRotatorExample.asp -->

<HTML>
<HEAD>
<TITLE>KV's Kool ASP - AdRotator Component Sample</TITLE>
</HEAD>
<BODY>

<p>Displaying Advertisements using AdRotator Component</p>

<%

' Declare a variable called adRotator

Dim adRotator

' Create an instance of adRotator component

Set adRotator=Server.CreateObject("MSWC.AdRotator")

' Use the following line if you want to display the advertisement in a new window

adRotator.TargetFrame = "target=_blank"

' Display an advertisement using AdRotator component based on information stored in adRotator.txt file

Response.Write adRotator.GetAdvertisement("adRotator.txt")

%>

<p>Refresh this page to see another advertisement.</p>

<p>Note: AdRotator Component displays advertisements randomly, so you may get the same advertisement second time. If so, refresh it again to see a new advertisement.<p>


</BODY>
</HTML>

<!-- End of the adRotatorExample.asp -->

Click here to see this sample in action!

Hope it is all clear!

Mail your comments (and doubts) to pkvnm@yahoo.com

 

Back to: Advertisement Management Systems - Overview



Refer this site ASPAlliance.com |  Contact Us |  Join |  Advertise |  Best Viewed with IE 4.0 or above