Article ID: 321812
Article Last Modified on 7/8/2003
APPLIES TO
- Microsoft ASP.NET 1.1
- Microsoft ASP.NET 1.0
This article was previously published under Q321812
SYMPTOMS
If the AdUrl in an XML file that is associated with an AdRotator WebForms control contains an ampersand (&) symbol, you receive the following server error message:
CAUSE
The error message occurs because the & symbol invalidates the XML file that is associated with the AdRotator control.
RESOLUTION
If you have to put an & symbol in the XML file (such as in the querystring of the URL specified for the NavigateUrl), you must replace it with & (the ampersand symbol, "amp", and a semicolon).
STATUS
This behavior is by design.
MORE INFORMATION
Steps to Reproduce the Behavior
- Start Microsoft Visual Studio .NET and create a new Web application project in either Microsoft Visual C# .NET or in Microsoft Visual Basic .NET.
- In the Design view, drag an AdRotator server control to the default WebForm1.aspx page.
Modify the properties of the AdRotator control so as to set the AdvertisementFile attribute to an XML file. The following code is a sample XML file that will cause the error to occur:
<?xml version="1.0" encoding="utf-8" ?> <Advertisements> <Ad> <NavigateUrl>http://localhost/test.aspx?a=2</NavigateUrl> <AlternateText>ad1</AlternateText> </Ad> <Ad> <NavigateUrl>http://localhost/test.aspx?a=1&b=1</NavigateUrl> <AlternateText>ad2</AlternateText> </Ad> </Advertisements>
- Save all the files, and then build the project.
- View the WebForm1.aspx page in the browser. You can expect to see the error mentioned in "Symptoms".
NOTE: The Webform appears correctly if (in the code in step 3) you just replace the & symbol with &.
REFERENCES
For more information about AdRotator server controls and ASP.NET server controls, visit the following MSDN and Microsoft Knowledge Base Web sites:
AdRotator Web Server Control
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/cpconadrotatorwebcontrol.asp?frame=true
ASP.NET Web Server Controls
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/cpconaspsyntaxforwebcontrols.asp?frame=true
306459 INFO: ASP.NET Server Controls Overview
Additional query words: AdRotator
Keywords: kbwebforms kbprb kbservercontrols KB321812