Get the App
SLTechnology News&Howtos  ›  Development  › 

What are the common problems with using AdRotator controls in asp.net

Shulou Source: shulou.com Published: 2022-06-02 08:31:27 11月16日 Update

This article mainly shows you "what are the common problems in using AdRotator controls in asp.net", the content is simple and clear, and I hope it can help you solve your doubts. Let me lead you to study and learn about "what are the common problems in using AdRotator controls in asp.net".

The AdRotator control is a server control that generates random advertising elements on the page and gets or sets the path of the XML file containing advertising information through the AdvertisementFile property. The following is the xml file I wrote during the test:

/ / File name:Ads.xml / / Author:Hoyah

< ?xml version="1.0" encoding="utf-8" ?>

< Adertisements>

< Ad>

< ImageUrl>

Images/5.jpg

< /ImageUrl>

< NavigateUrl>

Http://hi.baidu.com/hoyah

< /NavigateUrl>

< AlternateText>

Hoyah's Space

< /AlternateText>

< Impressions>

two hundred

< /Impressions>

< Keyword>

Hoyah

< /Keyword>

< /Ad>

< Ad>

< ImageUrl>

Images/1.jpg

< /ImageUrl>

< NavigateUrl>

Http://g.cn

< /NavigateUrl>

< AlternateText>

Google

< /AlternateText>

< Impressions>

five hundred

< /Impressions>

< Keyword>

Google

< /Keyword>

< /Ad>

< /Adertisements>

The code for the body section of the page is as follows:

< form ID="form1" runat="server">

< asp:AdRotator ID="AdRotator1" runat="server" AdvertisementFile="Ads.xml" Target="_blank"/>

< br />

< /form>

The following error message about the AdRotator control appears at run time:

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

I checked it several times but found no problem. Later, a closer look found that the Advertisements in Ads.xml is misspelled as Adertisements, and the system will not tell you exactly what went wrong at run time. So when you encounter such a problem, first check to see if there is any misspelling, and then look at the case problem, because xml is strictly case-sensitive. For example, if you put the above in Ads.xml

< NavigateUrl>

Http://hi.baidu.com/hoyah

< /NavigateUrl>

Mistakenly written as

< Navigateurl>

Http://hi.baidu.com/hoyah

< /Navigateurl>

There will be the same mistake as the wrong word on it. In addition, pay attention to the path of the picture and the path of the xml file that AdvertisementFile points to, which are particularly error-prone.

The above is all the content of the article "what are the common questions about using AdRotator controls in asp.net?" Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Controls questions FAQs content files articles paths information words size ads pages learning help check run code elements pictures Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei vpn Xiaomi macOS Shulou Tech Info