我对ASP.NET非常陌生,我仍然在学习基础知识和如何使用各种控件。我使用了adRotator控件,并使用下面提到的代码创建了XML,但是当在浏览器中执行时,它将显示错误消息(我将在代码后发布)
XML文件:
<?xml version="1.0" encoding="utf-8"?>
<Advertisement>
<Ad>
<ImageUrl> images/Logo.gif</ImageUrl>
<NavigateUrl>http://www.google.co.in</NavigateUrl>
<AlternateTExt> Main </AlternateTExt>
<Keyword>LogoImage</Keyword>
</Ad>
<Ad>
<ImageUrl> images/RedBik.gif</ImageUrl>
<NavigateUrl>http://www.yahoo.co.in</NavigateUrl>
<AlternateTExt> Main2 </AlternateTExt>
<Keyword>RedBikImage</Keyword>
</Ad>
</Advertisement>Default.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:AdRotator id="AdRotator1"
style="Z-INDEX: 102; LEFT: 32px;
POSITION: absolute; TOP: 32px; height: 222px; width: 883px;"
runat="server" AdvertisementFile="~/myAds.xml">
</asp:AdRotator>
</div>
</form>
</body>
</html>请注意,我没有在文件Default.aspx.cs中编写任何代码。我在浏览器中得到的错误消息是:
“/AdRotatorControl”应用程序中的服务器错误。运行时错误描述:服务器上发生应用程序错误。此应用程序的当前自定义错误设置防止查看应用程序错误的详细信息。详细信息:若要在本地服务器计算机上查看此特定错误消息的详细信息,请在当前web应用程序根目录中的"web.config“配置文件中创建一个标记。然后,该标记应该将其"mode“属性设置为"RemoteOnly”。若要使详细信息可在远程计算机上查看,请将“模式”设置为“Off”。。
Web.Config
<configuration>
<system.web>
<customErrors mode="RemoteOnly"/>
</system.web>
</configuration>注意:您看到的当前错误页可以通过修改应用程序配置标记的"defaultRedirect“属性来指向自定义错误页面URL来替换为自定义错误页。
<configuration>
<system.web>
<customErrors mode="On" defaultRedirect="mycustompage.htm"/>
</system.web>
</configuration>有谁能识别错误并请帮助我吗?
请帮帮我!
提前感谢!
发布于 2009-08-11 07:54:47
您需要编辑web.config文件以启用详细的错误消息,为此,请将此标记添加到您的web.config中:
<customErrors mode="Off"/>https://stackoverflow.com/questions/1258817
复制相似问题