| |||||||||||||||||||
AdRotator.AdvertisementFile PropertySystem.Web.UI.WebControls Namespace AdRotator Class Sets or retrieves the path to the XML file that contains advertisement data. Syntax
Property Value
The property is read/write with no default value. RemarksUse the AdvertisementFile property to specify the location of an XML file that contains advertisement information from which the AdRotator will randomly select an entry to display. For deployment and security purposes, it is strongly recommended that the XML file reside within the same Web application. It is only possible to access an XML file that is located in a different application on the same site if the application has sufficient permission. You can set this property to either:
Use of the AdvertisementFile property is optional. An advertisement may also be set programmatically via the handler of the AdCreated event. The XML file may contain the following attributes. Only the ImageUrl attribute, though, is required.
The AdvertisementFile must conform to the following predetermined XML format: <?xml xmlns = "Ad Rotator Schedule" ?>
<Advertisements>
<Ad>
<ImageUrl>URL of image to display</ImageUrl>
<NavigateUrl>URL of page to navigate to</NavigateUrl>
<AlternateText>Text to display</AlternateText>
<Keyword>Keyword used for filtering ads</Keyword>
<Impressions>relative weight of ad<Impressions>
</Ad>
</Advertisements>
Note the following regarding the advertisement file:
You can also include custom attributes by using custom tags in the XML file. All attribute tags are parsed from the advertisement file and the values are placed in the AdProperties dictionary, which can be used to programmatically access custom attributes. ExampleThe following example demonstrates how to declaratively set the AdvertisementFile property at design time. <asp:adrotator id = "myAds" runat = "server" advertisementfile = "myAds.xml" /> The following example illustrates how a typical XML advertisement file is formatted. <Advertisements>
<Ad>
<ImageUrl>image1.jpg</ImageUrl>
<NavigateUrl>http://www.site1.com</NavigateUrl>
<AlternateText>Site 1 Alternate Text</AlternateText>
<Keyword>Category1</Keyword>
<Impressions>100</Impressions>
</Ad>
<Ad>
<ImageUrl>image2.jpg</ImageUrl>
<NavigateUrl>http://www.site2.com</NavigateUrl>
<AlternateText>Site 2 Alternate Text</AlternateText>
<Keyword>Category2</Keyword>
<Impressions>80</Impressions>
</Ad>
</Advertisements>
See Also |
| ||||||||||||||||||
Check out related books at Amazon
© 2000-2008 Rey Nuñez All rights reserved.
If you have any question, comment or suggestion
about this site, please send us a note
You can help support aspxtreme