Search code examples
asp.netxmladrotator

ASP.NET AdRotator AdvertisementFile xml file from outside the application


I have an ASP.NET web site, let's call it MySite, and at the same level as the web site, a virtual folder - Data. And in that folder I have the xml file needed in an AdRotator control.

I put "http://localhost/Data/Ads.xml" in AdvertisementFile and I get this error:

'http://localhost/Data/Ads.xml' is not a valid virtual path.

Is there a way to get this working?


Solution

  • The xml file must be on the same website for security reasons, using the control out of the box.

    You could write your own methods to read a file from an external server, with an HttpWebRequest for example, then create a server side XML file from that stream and use it with the AdControl.

    There is also the AdCreated event to look at, too.