Introduction
Recently, I was working on AdRotator control in Asp.Net 2.0 at one stage while adding an Ads.xml file.
I noticed the following error.
Error
The AdRotator adRtrCtrl/adRotator1 could not find the AdvertisementFile or the file was invalid.
Possible causes
- Check the XML file to see if it is in well format.
- Check <NavigateUrl> tag if it is of the form http://www.csharpcorner.com/adv=Y&ID=123.
The ampersand & is a reserved charactor in XML, so you have to use &.
- If the nature of your XML file is something of the form as listed below.
If the first element in the above file is other than <Ad>, then it also gives an error. It has to have the very first child element as <Ad>; this is what I have observed with the code.
Example
Code for Default. aspx
Code for Ads.xml file
Note. I have tested the code 5-6 times with the above error.