Ad Rotator

Learn how to rotate your banner ads on your website with the Ad Rotator.

The following code should be inserted on each aspx page you would like the ad to appear on:
<asp:AdRotator AdvertisementFile="banners.xml" runat="server" target="_blank" />

Creating the Advertisement File

The advertisement file used by the AdRotator is a simple XML file that should use the following format:

banners.xml
<?xml version="1.0" encoding="utf-8" ?>
<Advertisements>
<Ad>
<ImageUrl>Banners/Image1.gif</ImageUrl>
<NavigateUrl>http://www.websolutions4me.com</NavigateUrl>
<AlternateText>WebSolutions4Me</AlternateText>
<Impressions>3</Impressions>
<Keyword>Web</Keyword>
<Caption>Web Design and Development Company</Caption>
</Ad>
<Ad>
<ImageUrl>Banners/Image2.gif</ImageUrl>
<NavigateUrl>http://www.websolutions4success.com</NavigateUrl>
<AlternateText>WebSolutions4Success</AlternateText>
<Impressions>2</Impressions>
<Keyword>Web</Keyword>
<Caption>PortFolio</Caption>
</Ad>
</Advertisements>


The advertisement file consists of the following elements:

<Advertisements> This tag should surround all ads within your file. This is called the root element.

<Ad>                    This tag contains all the attributes for a single ad within your ad list.

<ImageUrl>           The path of the image file that will be displayed.

<NavigateUrl>        The URL that the image file will link to.

<AlternateText>     The ALT text for the image. This will be displayed when a user hovers over the                                image or if the image can not be found.

<Keyword>            This is what the KeywordFilter property of the <asp:AdRotator> tag searches                                    for when filtering ads to display on a page.

<Impressions>       This property specifies the relative number of times this ad compared to the                                    other ads.


Code for Aspx Page


<%@ Page Language="VB" %>

<html>
<head>
</head>
<body>
<form runat="server">
<asp:AdRotator id="AdRotator1" runat="server" AdvertisementFile="banners.xml" Height="150px" Width="150px" target=”_blank”></asp:AdRotator>
</form>
</body>
</html>

View Demo