源代码:
<%@ Page Language="C#" ContentType="text/html" ResponseEncoding="gb2312" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<script language="C#" runat="server">
public void AdCreated(Object src,AdCreatedEventArgs e)
{
lblImageUrl.Text=(string) e.ImageUrl;
lblNavigateUrl.Text=(string) e.NavigateUrl;
lblAlternateText.Text=(string) e.AlternateText;
}
</script>
</head>
<body>
<form runat="server">
<asp:AdRotator id="ad" AdvertisementFile="ad.xml" BorderWidth="0" OnAdCreated="AdCreated" runat="server" /><br>
当前引用文件:<asp:Label id="lblImageUrl" ForeColor="red" runat="server" /><br>
链接到:<asp:Label id="lblNavigateUrl" ForeColor="red" runat="server" /><br>
说明文字:<asp:Label id="lblAlternateText" ForeColor="red" runat="server" /><br>
</form>
</body>
</html>
############################################################
错误提示:
Server Error in '/123456' Application.
--------------------------------------------------------------------------------
The 'Impressions' start tag on line '8' does not match the end tag of 'Imperessions'. Line 8, position 18.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Xml.XmlException: The 'Impressions' start tag on line '8' does not match the end tag of 'Imperessions'. Line 8, position 18.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[XmlException: The 'Impressions' start tag on line '8' does not match the end tag of 'Imperessions'. Line 8, position 18.]
System.Xml.XmlTextReader.ParseTag() +2328
System.Xml.XmlTextReader.ParseBeginTagExpandCharEntities() +1478
System.Xml.XmlTextReader.Read() +216
System.Xml.XmlLoader.LoadChildren(XmlNode parent) +33
System.Xml.XmlLoader.LoadElementNode() +144
System.Xml.XmlLoader.LoadCurrentNode() +38
System.Xml.XmlLoader.LoadCurrentNode() +192
System.Xml.XmlLoader.LoadChildren(XmlNode parent) +47
System.Xml.XmlLoader.LoadElementNode() +144
System.Xml.XmlLoader.LoadCurrentNode() +38
System.Xml.XmlLoader.LoadCurrentNode() +192
System.Xml.XmlLoader.LoadChildren(XmlNode parent) +47
System.Xml.XmlLoader.LoadElementNode() +144
System.Xml.XmlLoader.LoadCurrentNode() +38
System.Xml.XmlLoader.LoadCurrentNode() +192
System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc) +49
System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace) +102
System.Xml.XmlDocument.Load(XmlReader reader) +72
System.Web.UI.WebControls.AdRotator.LoadFile(String fileName) +227
[HttpException (0x80004005): The AdRotator ad was unable to parse the XML in the AdvertisementFile. The 'Impressions' start tag on line '8' does not match the end tag of 'Imperessions'. Line 8, position 18.]
System.Web.UI.WebControls.AdRotator.LoadFile(String fileName) +731
System.Web.UI.WebControls.AdRotator.GetFileData(String fileName) +148
System.Web.UI.WebControls.AdRotator.SelectAdFromFile() +39
System.Web.UI.WebControls.AdRotator.OnPreRender(EventArgs e) +72
System.Web.UI.Control.PreRenderRecursiveInternal() +62
System.Web.UI.Control.PreRenderRecursiveInternal() +125
System.Web.UI.Control.PreRenderRecursiveInternal() +125
System.Web.UI.Page.ProcessRequestMain() +1489
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573