Using the AdRotator control as a banner ad : AdRotator « ASP.net Controls « ASP.NET Tutorial






<%@ Page Language="C#" %>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>AdRotator Page</title>
</head>
<body>
    <form id="form1" runat="server">
        <asp:AdRotator ID="AdRotator1" Runat="server" 
         AdvertisementFile="MyAds.xml" />
        Lorem ipsum dolor sit 
        amet, consectetuer adipiscing elit. Duis vel justo. Aliquam 
        adipiscing. In mattis volutpat urna. Donec adipiscing, nisl eget 
        dictum egestas, felis nulla ornare ligula, ut bibendum pede augue 
        eu augue. Sed vel risus nec urna pharetra imperdiet. Aenean 
        semper. Sed ullamcorper auctor sapien. Suspendisse luctus. Ut ac 
        nibh. Nam lorem. Aliquam dictum aliquam purus.
    </form>
</body>
</html>

File: MyAds.xml

<?xml version="1.0" encoding="utf-8" ?>
<Advertisements xmlns="http://schemas.microsoft.com/AspNet/AdRotator-Schedule-File">
  <Ad>
    <ImageUrl>book1.gif</ImageUrl>
    <NavigateUrl>http://www.wrox.com</NavigateUrl>
    <AlternateText>Visit Wrox Today!</AlternateText>
    <Impressions>50</Impressions>
    <Keyword>VB.NET</Keyword>
  </Ad>
  <Ad>
    <ImageUrl>book2.gif</ImageUrl>
    <NavigateUrl>http://www.wrox.com</NavigateUrl>
    <AlternateText>Visit Wrox Today!</AlternateText>
    <Impressions>50</Impressions>
    <Keyword>XML</Keyword>
  </Ad>
</Advertisements>








3.28.AdRotator
3.28.1.AdRotator randomly display different advertisements in a page
3.28.2.AdRotator for displaying your ad (C#)
3.28.3.OnAdCreated event
3.28.4.Storing Advertisements in an XML File
3.28.5.Storing Advertisements in a Database Table
3.28.6.Using the AdRotator control as a banner ad