Using the AdRotator control in ASP.net

Source: Internet
Author: User

In this article, we'll look at two examples that use AdRotator server controls to display ads on one page.

There are several steps to using the AdRotator server control:

First step

Create an XML file that contains the details of the advertisement, such as Art008_ads.xml, which contains the following elements:

imageurl-contains the URL that will be displayed, either an absolute path or a relative path relative to the page that displays the advertisement.

navigateurl-contains the URL of the target Web site. (Note: Before the beta version, this element was called TargetUrl and now changed).

alternatetext-contains some text that is displayed as a hint when the mouse moves over the image. In other words, this is the text of the ALT element in the advertisement image.

keyword-This optional element contains the category that the advertisement belongs to. This allows all categories of ads to be in the same XML, and then filters the ads on a given page using the KeywordFilter property in the AdRotator control.

impressions-points to the relative cost of advertising.

One thing that is particularly noteworthy when creating an ad file is that it is case-sensitive. Therefore, the included elements should be spelled correctly, for example: you should use <Ad> instead of <ad>.

With the above details, we will create the ad XML file. The following XML file contains information that displays two ad banners:

<Advertisements>
<Ad>
<ImageUrl>/articles/demo/art008_demo1.gif</ImageUrl>
<NavigateUrl>http://www.dotnet101.com</NavigateUrl>
<alternatetext>go to. net101--Test 1</alternatetext>
<Keyword>Category1</Keyword>
<Impressions>10</Impressions>
</Ad>
<Ad>
<ImageUrl>/articles/demo/art008_demo2.gif</ImageUrl>
<NavigateUrl>http://www.dotnet101.com</NavigateUrl>
<alternatetext>go to. net101--Test 2</alternatetext>
<Keyword>Category1</Keyword>
<Impressions>10</Impressions>
</Ad>
<Ad>
<ImageUrl>/articles/demo/art008_demo3.gif</ImageUrl>
<NavigateUrl>http://www.dotnet101.com</NavigateUrl>
<alternatetext>go to. net101--Test 3</alternatetext>
<Keyword>Category2</Keyword>
<Impressions>10</Impressions>
</Ad>
</Advertisements>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.