Easy to make mistakes using the AdRotator control: misspelling and Case sensitivity of words

Source: Internet
Author: User

The AdRotator control is a server control used to generate random ad elements on the page and obtain or set the path of the 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 about the AdRotator control 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.

The above are the most common problems with using the AdRotator control in asp.net.

  1. Application of session storage mode in ASP. NET
  2. Set of methods for uploading and downloading files in ASP. NET
  3. Introduction to cookie read/write methods in ASP. NET
  4. Javascript operations in ASP. NET
  5. Introduction and implementation of Single Sign-On in ASP. NET2.0

Related Article

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.