The adrotator control are used to display the advertisement banner on the web pages.
Use the AdRotator control display a randomly selected advertisement banner on the web page. The display advertisement changes whenever the page refreshes.
Advertisement information stored in a separate XML file. The XML file allows you to maintain a list of advertisements and their associated attributes. Attributes include the path to an image to display, the URL to link to when the control is clicked, the alternate text to display when the image is not available, a keyword and the frequency of the advertisement.
Example of AdRotator :
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:AdRotator ID="AdRotator1" runat="server" Target="_blank" AdvertisementFile="~/Ads.xml" />
</div>
</form>
</body>
</html>
Now create the xml file for storing the ads information.
<Advertisements>
<Ad>
<ImageUrl>~/Images/image1.jfif</ImageUrl>
<height>60</height>
<width>190</width>
<NavigateUrl>http://www.microsoft.com</NavigateUrl>
<AlternateText>Microsoft Main Site</AlternateText>
<Impressions>80</Impressions>
<Keyword>Topic1</Keyword>
</Ad>
<Ad>
<ImageUrl>~/Images/image2.jfif</ImageUrl>
<height>90</height>
<width>90</width>
<NavigateUrl>http://www.google.com</NavigateUrl>
<AlternateText>Google</AlternateText>
<Impressions>80</Impressions>
<Keyword>google</Keyword>
</Ad>
<Ad>
<ImageUrl>~/Images/image2.jpg</ImageUrl>
<height>90</height>
<width>90</width>
<NavigateUrl>http://www.youtube.com</NavigateUrl>
<AlternateText>Youtube</AlternateText>
<Impressions>80</Impressions>
<Keyword>youtube</Keyword>
</Ad>
</Advertisements>
No comments:
Post a Comment