Passing database login info to Crystal report - problem going to production
-
Firstly, I have this working in development, however when I publish to the production webserver, instead of generating the report, it asks me for login credentials again. Here is a snapshot of my entire code behind file: using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using CrystalDecisions.CrystalReports.Engine; using CrystalDecisions.Shared; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if ((ViewState["ParametersShown"] != null) && (ViewState["ParametersShown"].ToString() == "True")) { ReportListing myListing = new ReportListing(); BindReport(ConfigurationManager.AppSettings["reportlocation"].ToString() + myListing.GetReportFileName(Session["Report"].ToString())); } } protected void btnBuild_Click(object sender, EventArgs e) { CrystalReportViewer1.ParameterFieldInfo.Clear(); DateTime startDate = DateTime.Parse(Session["FromDate"].ToString()); DateTime endDate = DateTime.Parse(Session["ToDate"].ToString()); ParameterFields paramFields = new ParameterFields(); ParameterField crStartDate = new ParameterField(); ParameterField crEndDate = new ParameterField(); crStartDate.Name = "@StartDate"; crEndDate.Name = "@EndDate"; ParameterDiscreteValue dcrStartDate = new ParameterDiscreteValue(); ParameterDiscreteValue dcrEndDate = new ParameterDiscreteValue(); dcrStartDate.Value = startDate; dcrEndDate.Value = endDate; crStartDate.CurrentValues.Add(dcrStartDate); crEndDate.CurrentValues.Add(dcrEndDate); paramFields.Add(crStartDate); paramFields.Add(crEndDate); ReportListing myListing = new ReportListing(); BindReport(ConfigurationManager.AppSettings["reportlocation"].ToString() + myListing.GetReportFileName(Session["Report"].ToString())); CrystalReportViewer1.ParameterFieldInfo = paramFields; ViewState["ParametersShown"] = "True"; ViewState["ReportName"] = Session["Report"].ToString(); } private void BindReport(string FilePath) { ReportDocument Report = new ReportDocumen