How to rotate ads using Adrotator component

Ads are everywhere on the web. Don't know whether its better or for worse, but the 440 X 60 sized banner ads has become as instantly recognizable a part on the web nowadays. Microsoft makes it easy to add a randomly changing banner to your site with the Ad Rotator component.


Using the Ad Rotator

You need three components to use the Ad Rotator. The first is a file that tells the Ad Rotator what images to use, what to link them to, and so on. This file is called the rotator schedule file. The second part is an ASP page that handles redirection the user to the appropriate URL. The third part is the actual page that will display the ads.

This first thing to do is create a rotator schedule file. This file contains the following options:

REDIRECT, WIDTH pixel width, HEIGHT pixel_hight , BRODER broder_thickness , * , first Image URL, homepage URL, Alt Text, Weight , second Image URL , Homepage URL, Alt Text , and Weight.

The first three affect every banner. URL is the URL of an ASP page or a .dll of yours that will handle redirecting the user to the correct page. This option allows you to control what happens when a user clicks the banner. You can force the new page to open in a separate window. You will probably want to record for your statistics that someone has clicked that banner. This can be either a full URL or a relative one. Specifying a URL is optional. Simply omit the line if you want the current page to handle redirection.

Pixel_width : specifies the width of the banner in pixels. This line is also optional. The default is 440.

Pixel_height : specifies the height of the banner in pixels. This line is also optional. The default is 60.

Pixel_thickness : specifies the thickness, in pixels, of the border that is drawn around the image. This line is also optional. The default value is 1.

The asterisk on the line 5 is important. It indicates where the first section of the file ends and the second section begin. It must be on a line by itself. The second section consists of four lines per ad.

First Image URL :

Is a URL that specifies where to find the graphic to display for this ad. It may be either a relative URL or a full one.

Homepage URL:

Is the URL that the user should be taken to when he clicks the link? This URL is then passed on to the redirect URL. If there is no page to redirect, a hyphen (-) should be used.

Alt Text :

Is the text that should be displayed when the user has graphics turned off. It is also displayed before the image has loaded and when the user moves his/her mouse over the image.

Weight :

Is a number between 0 and 10,000 that indicates how the ad should be weighted? If all the ads in the list have the same weight, they will all be equally likely to appear. If there were three ads, one of weight 10 and two of weight 20, the one with weight 10 would appear 20% of the time, and the other would each appear 40% of the time.


“Amazon and the Amazon logo are trademarks of Amazon.com, Inc. or its affiliates.”

| Privacy Policy for www.dotnet-guide.com | Disclosure | Contact |

Copyright - © 2004 - 2024 - All Rights Reserved.