AdRotator controls are used to create a dynamic ads. The AdRotator Control presents ad images each time a user enters or refreshes a webpage. When the ads are clicked, it will navigate to a new Web location. The AdRotator control is used to display a sequence of ad images.The AdRotator control to work we need an Advertisement file (XML file) and some sample images.
Adding the AdRotator web server control to your web application. first, select the AdRotator and drag and drop the control to your web form. Map the XML file which contains the details about each and every ad.
The advertisement file is an XML file. The following are some of the elements of this XML file.
- <imageUrl>: Optional. The path to the image file.
- <NavigateUrl>: Optional. The URL to link to if the user clicks the ad.
- <AlternateText>: Optional. An alternate text for the image.
- <Impressions>: Optional. The display rates in percent of the hits.
XML code that has the details about the ads. The file Ads.xml looks like the code below:
- <Advertisements>
- <Ad>
- <ImageUrl>adimages/2.jpg</ImageUrl>
- <NavigateUrl>http:
- <AlternateText>Cat 2</AlternateText>
- <Impressions>30</Impressions>
- </Ad>
- <Ad>
- <ImageUrl>adimages/3.jpg</ImageUrl>
- <NavigateUrl>http:
- <AlternateText>Cat 3</AlternateText>
- <Impressions>20</Impressions>
- </Ad>
- <Ad>
- <ImageUrl>adimages/4.jpg</ImageUrl>
- <NavigateUrl>http:
- <AlternateText>Cat 4</AlternateText>
- <Impressions>10</Impressions>
- </Ad>
- </Advertisements>