我使用 C#创建了一个网站。当我在计算机上运行它时,它工作得很好。但在托管后运行时会产生运行时错误。在这里,我添加了错误的屏幕截图。enter image description here
这是 asp 代码
<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true"
CodeBehind="surrenderLetterT.aspx.cs" Inherits="Letters_Auto_Generator.surrenderLetterT" %>
<%@ Register Assembly="CrystalDecisions.Web, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"
Namespace="CrystalDecisions.Web" TagPrefix="CR" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<CR:CrystalReportViewer ID="CrystalReportViewer3" runat="server" AutoDataBind="true"
Height="1039px" ReportSourceID="CrystalReportSource2" Width="901px" />
<CR:CrystalReportSource ID="CrystalReportSource2" runat="server">
<Report FileName="CrystalReport2.rpt">
</Report>
</CR:CrystalReportSource>
</asp:Content>
&#13;
以下是 .cs
中的代码 public partial class surrenderLetterT : System.Web.UI.Page
{
DBClass db = new DBClass();
protected void Page_Load(object sender, EventArgs e)
{
string policyNo = Session["PolNo"].ToString();
string eid = Session["EMPID"].ToString();
//CrystalReportViewer1.Visible = true;
DataSet printdtls = db.print(policyNo);
DataSet dsUserInfo = db.getdesignation(eid);
string Ename = dsUserInfo.Tables[0].Rows[0]["Name"].ToString();
string Desig = dsUserInfo.Tables[0].Rows[0] ["Designation"].ToString();
if (printdtls.Tables[0].Rows.Count > 0)
{
ReportDocument myReport = new ReportDocument();
myReport.Load(Server.MapPath("~\\CrystalReport2.rpt"));
myReport.SetDataSource(printdtls.Tables[0]);
myReport.SetParameterValue("PolicyNo", policyNo);
myReport.SetParameterValue("Name", Ename);
myReport.SetParameterValue("designation", Desig);
CrystalReportViewer3.ReportSource = myReport;
}
}
}
答案 0 :(得分:0)
要确实显示错误,请将此行添加到system.web
节点
<customErrors mode="Off"/>
此行到system.webServer
节点
<httpErrors existingResponse="PassThrough"/>