下面的示例说明可以如何使用adrotator控件在页上动态显示旋转的广告。
aspx文件:
<%@ page language=”c#”%>
<html>
<head>
</head>
<body>
<center>
<form action=”intro5.aspx” method=”post” runat=”server”>
<asp:adrotator advertisementfile=”ads.xml” bordercolor=”black” borderwidth=1 runat=”server”/>
</form>
</center>
</body>
</html>
ads.xml文件:
<advertisements>
<ad> <imageurl>/quickstart/aspplus/images/banner1.gif</imageurl>
<navigateurl>http://www.microsoft.com</navigateurl>
<alternatetext>alt text</alternatetext>
<keyword>computers</keyword>
<impressions>80</impressions>
</ad>
<ad>
<imageurl>/quickstart/aspplus/images/banner2.gif</imageurl>
<navigateurl>http://www.microsoft.com</navigateurl>
<alternatetext>alt text</alternatetext>
<keyword>computers</keyword>
<impressions>80</impressions>
</ad>
<ad>
<imageurl>/quickstart/aspplus/images/banner3.gif</imageurl>
<navigateurl>http://www.microsoft.com</navigateurl>
<alternatetext>alt text</alternatetext>
<keyword>computers</keyword>
<impressions>80</impressions>
</ad>
</advertisements>