上面是web项目部署到服务器之后请求的网址。
正常返回的的请求返回和url的文件名一致的模板
但是现在遇到这种情况就是:刷新网页的时候,如果有其他用户请求其他的文件,界面渲染就变成其他用户请求的。
- public partial class ReportToPrint : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!IsPostBack)
- {
- this.Session["orderNumber"] = Request.QueryString["orderNumber"];
- this.Session["RdlxName"] = Request.QueryString["RdlxName"];
- this.Session["PrintFlag"] = Request.QueryString["PrintFlag"]==null?"A" : Request.QueryString["PrintFlag"];
- this.Session["FaccID"] = Request.QueryString["FaccID"] == null ? "" : Request.QueryString["FaccID"];
- this.Session["Parameter"] = Request.QueryString["Parameter"] == null ? "" : Request.QueryString["Parameter"];
- FileInfo path = new FileInfo(Server.MapPath("/RdlReports/" + this.Session["RdlxName"].ToString()));
- GrapeCity.ActiveReports.PageReport report1 = new GrapeCity.ActiveReports.PageReport(path);
- //绑定数据源
- report1.Document.LocateDataSource += Document_LocateDataSource;
- //绑定参数
- if (this.Session["Parameter"] != null)
- {
- bindReportParam(report1, this.Session["Parameter"].ToString());
- }
-
- arvWebMain.PdfExportOptions.FitWindow = true;
- arvWebMain.PdfExportOptions.DisplayMode = GrapeCity.ActiveReports.Export.Pdf.Section.DisplayMode.Outlines;
- arvWebMain.ViewerType = ActiveReports.Web.ViewerType.HtmlViewer;
- arvWebMain.DisplayMode = ActiveReports.Web.DisplayMode.Continuous;
- arvWebMain.Report = report1;
- }
- }
- private void Document_LocateDataSource(object sender, LocateDataSourceEventArgs args)
- {
- if (this.Session["PrintFlag"].ToString().Contains("JSON"))//行记录为多数据确定
- {
- Business.GetData.setARDataJson(args,
- this.Session["RdlxName"].ToString(),
- this.Session["orderNumber"].ToString(),
- this.Session["PrintFlag"].ToString(),
- this.Session["FaccID"].ToString());//K3账套
- }
- else
- {
- //多选模式','分割--B
- if (this.Session["PrintFlag"].ToString() == "B"|| this.Session["PrintFlag"].ToString().Contains("B_"))
- {
- string orderNumber = this.Session["orderNumber"].ToString();
- orderNumber = orderNumber.Trim();
- if (orderNumber.LastIndexOf(",")+1 == orderNumber.Length)
- {
- orderNumber = orderNumber.Substring(0, orderNumber.Length - 1);
- }
- orderNumber = "'" + orderNumber.Replace(",", "','") + "'";
- orderNumber = orderNumber.Replace("''", "'");
- this.Session["orderNumber"] = orderNumber;
- }
- Business.GetData.setARData(args,
- this.Session["RdlxName"].ToString(),
- this.Session["orderNumber"].ToString(),
- this.Session["PrintFlag"].ToString(),
- this.Session["FaccID"].ToString());//K3账套
- }
-
- }
- private void bindReportParam(PageReport report1,string Parameter)
- {
- string[] param_s = Parameter.Split(',');
- if (param_s.Length == report1.Report.ReportParameters.Count)
- {
- for (int i = 0; i < param_s.Length; i++)
- {
- report1.Report.ReportParameters[i].DefaultValue.Values.Clear();
- report1.Report.ReportParameters[i].DefaultValue.Values.Add(param_s[i]);
- }
- }
- else
- {
- Console.Write(report1.Report.Name + "参数与url不符!");
- }
-
- }
- }
复制代码 上图为后台绑定
|