Duplicate calling Service MVC core

Posted by: tung.nguyen4 on 20 March 2023, 1:56 am EST

  • Posted 20 March 2023, 1:56 am EST - Updated 20 March 2023, 2:06 am EST

    • I have a core MVC project with WebApplication configuration as follows:
    app.UseReporting(settings =>
                        settings.UseCompression = true;
    • The ReportHelper.GetReport as follows:
    public static class ReportHelper
            public static object GetReport(string reportParams)
                if (string.IsNullOrEmpty(reportParams))
                    throw new ArgumentNullException(nameof(reportParams));
                using (var scope = Program.App.Services.CreateScope())
                    var jObj = JObject.Parse(Base64Decode(reportParams));
                    var reportServiceName = jObj.GetValue("ReportName")?.ToString();
                    var reportService = scope.CreateReportService(reportServiceName);
                    return reportService.GetReportView(jObj.GetValue("Params")?.ToString());
            private static string Base64Decode(string base64EncodedData)
                return Encoding.UTF8.GetString(Convert.FromBase64String(base64EncodedData));
    • The code in view as follows:
    let reportName = document.getElementById("reportName").value;
    let reportParam = document.getElementById("reportParam").value;
    let params = { ReportName: reportName, Params: reportParam };
        reportID: btoa(JSON.stringify(params))

    The report I am using is GrapeCity.ActiveReports.SectionReport

    And when ActiveReport on the BE side calls the Service, for example CustomerLedgerReportService has a method GetReportView(string param) then I’m seeing calling that method twice.

    So will duplicate processing to generate report. Please let me know if my implementation is correct or not and how to handle it?

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels