AdRotator control in ASP. NET

Source: Internet
Author: User

This article introduces ASP. NET AdRotator control, many people may not understand ASP. the AdRotator control in NET does not matter. After reading this article, you will certainly have a lot of GAINS. I hope this article will teach you more.

The AdRodator control is used to generate random ad elements on the page and obtain or set the path of an XML file containing ad information through the AdvertisementFile attribute. The xml file I wrote during the test is as follows:

 
 
  1. //File name:Ads.xml  
  2. //Author:Hoyah  
  3. < ?xml version="1.0" encoding="utf-8" ?>  
  4. < Adertisements>  
  5. < Ad>  
  6.     < ImageUrl>images/5.jpg< /ImageUrl>  
  7.     < NavigateUrl>http://hi.baidu.com/hoyah< /NavigateUrl>  
  8.     < AlternateText>Hoyah's Space< /AlternateText>  
  9.     < Impressions>200< /Impressions>  
  10.     < Keyword>Hoyah< /Keyword>  
  11. < /Ad>  
  12. < Ad>  
  13.     < ImageUrl>images/1.jpg< /ImageUrl>  
  14.     < NavigateUrl>http://g.cn< /NavigateUrl>  
  15.     < AlternateText>Google< /AlternateText>  
  16.     < Impressions>500< /Impressions>  
  17.     < Keyword>Google< /Keyword>  
  18. < /Ad>  
  19. < /Adertisements>  
  20.  

The code of the page body is as follows:

 
 
  1. < form ID="form1" runat="server">  
  2.     < asp:AdRotator ID="AdRotator1" runat="server" AdvertisementFile="Ads.xml" Target="_blank"/>< br />  
  3. < /form>  

The following error message is displayed during running:

The AdRotator AdRotator1 cocould not find the AdvertisementFile or the file is invalid.

No problem was found after checking it several times. Later, I found that the Advertisements in Ads. xml is incorrectly written as Adertisements, but the system will not tell you exactly what went wrong during the runtime. To solve this problem, first check whether words are spelled incorrectly. Then, check whether words are case sensitive in xml. For example

 
 
  1. < NavigateUrl>http://hi.baidu.com/hoyah< /NavigateUrl> 

The error code is

 
 
  1. < Navigateurl>http://hi.baidu.com/hoyah< /Navigateurl> 

The error is the same as the word above. In addition, the image path and AdvertisementFile point to the xml file path, which are particularly error-prone.

This solves the problem of using the AdRotator control in ASP. NET.

  1. How does ASP. NET Eval bind data?
  2. Example: ASP. NET Eval: How to Write database binding expressions
  3. A special method for verifying ASP. net mvc data
  4. ASP. NET close Page Server dialog layer clear
  5. Simple Analysis of ASP. net mvc Control Project Development

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.