我该如何解决这个问题?
当我通过本地计算机运行系统时,它不需要任何登录到数据库身份验证,我可以直接看到我的报告。但是当我将我的系统转移到服务器中以便其他人可以远程访问它时,它需要一个登录数据库,甚至信息都是正确的。 这里是我的.cs代码
public partial class PrintPreview : System.Web.UI.Page
{
ReportDocument crPrint = new ReportDocument();
protected void Page_Init(object sender, EventArgs e)
{
if (Session["ID"] == null)
{
Response.Redirect("../Account/LogIn.aspx");
}
else
{
string i = Session["tID"].ToString();
//CrystalReportViewer1.Visible = true;
string reportPath = Server.MapPath("../CrystalReport2.rpt");
crPrint.Load(reportPath);
crPrint.SetDatabaseLogon("sa", "Pr0cess", "172.20.3.24", "PO");
crPrint.SetParameterValue("MOSEFNo", i);
CrystalReportViewer1.ReportSource = crPrint;
}
}
}
当我将数据库传输到数据库时总是需要数据库登录,为什么会这样?
当我将文件夹传输到IIS时," asp_client"文件夹总是空的,我该如何解决这个问题?谢谢!
答案 0 :(得分:0)
问题是,当您重新加载页面时,会话[" ID"]将重置为NULL。尝试将会话状态检查为状态服务器模式。