KSDY_LZQ 发表于 2022-9-15 13:50:04

ar16-webview .net 服务器请求到 其他用户的请求的模板


上面是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.DefaultValue.Values.Clear();
                  report1.Report.ReportParameters.DefaultValue.Values.Add(param_s);
                }
            }
            else
            {
                Console.Write(report1.Report.Name + "参数与url不符!");
            }
            
      }


    }上图为后台绑定

Felix.Li 发表于 2022-9-15 19:36:44

你先试一下在第八行那里打一个断点,看一下RdlxName是不是已经变了,如果这里变了肯定会就是请求的传值有问题,请求传过来的已经有问题了,检查一下前段传的值是不是哪里每次用了一个全局参数,然后被新用户访问的时候修改了。

KSDY_LZQ 发表于 2022-9-16 08:39:05

Felix.Li 发表于 2022-9-15 19:36
你先试一下在第八行那里打一个断点,看一下RdlxName是不是已经变了,如果这里变了肯定会就是请求的传值有问 ...

我试了一下 按“F5”会进入我上面的代码段,可以正常代入模板文件。
而点击工具栏上面的“刷新” 不会进代码段,而且会渲染所有请求中最近的一次
测试:(我开了两个模板(A/B),先请求A,后请求B,然后在A点‘刷新’就显示B的模板)
生产环境:有反应弹出来的新页面就不是正确的模板。(待确认)

wengMQ 发表于 2022-9-16 11:37:00

是不是session被覆盖了??

Bella.Yuan 发表于 2022-9-16 12:17:46

wengMQ 发表于 2022-9-16 11:37
是不是session被覆盖了??

感谢老铁回复{:5_117:},目前推测也有可能是这个原因,您可以先检查一下。

KSDY_LZQ 发表于 2022-9-16 12:54:10

wengMQ 发表于 2022-9-16 11:37
是不是session被覆盖了??

不知道是不是session的问题,生产环境说的 新页面串模板的现象没有复现。
但是复现了点击工具栏的的刷新会渲染最后一次请求的问题(上面提到的),直接点地址刷新的是正常的。
所以webview展示的话 是怎么限制工具栏的刷新不显示,还是只能通过jsview的方式来限制

Bella.Yuan 发表于 2022-9-16 19:00:56

KSDY_LZQ 发表于 2022-9-16 12:54
不知道是不是session的问题,生产环境说的 新页面串模板的现象没有复现。
但是复现了点击工具栏的的刷新 ...

您好,建议您使用jsviewer,您可以按下面的代码移除刷新按钮
viewer.toolbar.desktop.removeItem('$refresh');
页: [1]
查看完整版本: ar16-webview .net 服务器请求到 其他用户的请求的模板