在我从其他人那里接管的网站上 - 在将水晶报表加载到报表查看器之前出现此行
System.Environment.SetEnvironmentVariable("TMP", @"C:\Temp");
它不再被提及 - 除了页面下方的错误消息似乎只是报告“TMP”等于 C:\Temp
那条线实际上是做什么的?
这是完整的代码:
ReportDocument ViewReport = new ReportDocument();
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Page_Init(object sender, EventArgs e)
{
try
{
string ReportPath = Server.UrlDecode(Request["Path"]);
System.Environment.SetEnvironmentVariable("TMP", @"C:\Temp");
ViewReport.Load(@ReportPath);
ViewReport.SetDatabaseLogon(ConfigurationManager.AppSettings["ReportsUser"], ConfigurationManager.AppSettings["ReportsPassword"]);
CrystalReportViewer1.Height = 640;
CrystalReportViewer1.Width = 1100;
CrystalReportViewer1.BestFitPage = false;
CrystalReportViewer1.PrintMode = CrystalDecisions.Web.PrintMode.ActiveX;
CrystalReportViewer1.ReportSource = ViewReport;
CrystalReportViewer1.RefreshReport();
}
catch (Exception err)
{
string Err = "Error :-" + err.Message;
Err = Err + "Source :-" + err.Source;
Err = Err + "Inner Error :-" + err.InnerException.Message.Replace("\r", "");
Err = Err + "Path not found :-" + Server.UrlDecode(Request["Path"]);
Err = Err + " TMP=" + System.Environment.GetEnvironmentVariable("TMP");
string Message = "<script> alert(' " + Err + "');</script>";
Response.Write(Message);
}
}