ProgrammerGuide.Net | Step by Step Programmer Guide

ASP Components

ASP Common Components,

Developing with Microsoft’s ASP Components
Three components are probably already  installed on your system. Microsoft includes Ad Rotator, Content Linker and Browser Capabilities components with Personal Web Server (PWS) and IIS. These three are pretty easy to use and can be very handy.

Ad Rotator
Ads are everywhere in web. For better or for worse, the 440 by 60 banner ad has become as instantly recognizable a part of a Web as the “www.com”. Microsoft makes it easy to add a random 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 the file that tells the Ad Rotator What image to use, What to link then to, and so on. This is called the rotator Schedule file. The second part is an ASP page that handles redirecting the user to the appropriate URL. The third part is the actual page that that will display the ads.

The first thing to do is create a rotator schedule file. This is done like this:
 

1 : REDIRECT URL
2 : WIDTH pixel_width
3 : HEIGHT pixel_height
4 : BODER boder_thickness
5 : *
6 : First Image URL
7 : HomePageURL
8 : AltText
9 : Weight
10 : SecondImageURL
11 : HomePageURL
12 : AltText
13 : Weight
14 : …..

URL (line 1) 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 be either a full URL or a relative one.

pixel_width (line 2) specifies the width of the banners in pixels. This lines is also optional. The default is 440.

pixel_height (line 3) specifies the height of the banner in pixels. The line is also optional. The default is 60.

boder_thickness (line 4) specifies the thickness, in pixels, of the border that is drawn around the image. This line is optional. The default value is 1.

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

FirstImageURL (line 6) is a URL that specifies where to find the graphic to display for this ad. It may either a relative URL or a full one.

HomePageURL (line 7) is the URL that the user should be taken to when he clicks the links. This URL is then passed on to the redirect URL. If there is no page they should be taken to, a hyphen (-) should be used.

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

weight (line 9) is a number between 0 and 10,000 that indicated how the ad should be weighted. If all the ads in the list have the same weight then, they will all be equally likely to appear. If there were three ads, one of weight 10 and two of weight 20, the one of weight 10 would appear 20% of the time, and the other would each appear 40% of the time. The fraction of the time an ad will appear is computed by dividing its weight by the sum of all the weight in the file. If the sum of all the weights in the file is more than 10,000 an error will occur.

Many sites that sell advertising have a standard that most ads are given. Then they allow advertiser to pay extra to have their ad appear twice as often as normal. In this case, that ad would be given a weight equal to twice the normal weight. You might also allow an advertiser to buy one block and use four different block. In this case, each ad would given a weight of  one-fourth the normal weight.

You can specify any numbers of banners to be displayed. Simply repeat the pattern. Each banners needs four lines of information. So let’s create a rotator schedule file that has four ads. Save following listing as AdList.txt.

Please click here for related products on Amazon!

Jayashee

Add comment

Want to Check Celebrities News?