Tuesday, April 8, 2008

How to add AdRotator in ASP.NET using VB.NET

AdRotator is used to randomize pictures (images) whenever you load or refresh a web page. To add an AdRotator you simply have to drag a adrotator from toolbox and place it on your ASP.NET page. Then you have to add an xml file. The attributes of the xml file will be the following:

<?xml version="1.0" encoding="utf-8" ?>
<Advertisements>

<Ad>
<ImageUrl>Pix/yarn/1.gif</ImageUrl>
<AlternateText>Image is not displayed</AlternateText>
</Ad>

<Ad>
<ImageUrl>Pix/yarn/2.jpg</ImageUrl>

<AlternateText>Image is not displayed</AlternateText>
</Ad>

<Ad>
<ImageUrl>Pix/yarn/3.jpg</ImageUrl>
<AlternateText>Image is not displayed</AlternateText>
</Ad>
</Advertisements>


Now save the file with as "Ads.xml" and go back to your ASP.NET Page where you have place that AdRotator and give "Ads.xml" as a value to its AdvertisementFile attribute.

Run the page and you will see the images.

No comments: