"The report is not specified" error by disabling cache in Stimulusoft

Viewed 372

I am using Stimul Soft v2020.2.1 I open the personal report page named "user1" and in another tab I open another person report named "user2". Now if the user goes to the "user1" tab and wants to print or request output, I get the "user2" report by mistake, which is due to caching. To disable this default feature, I added the following code in Helper:

Server =
    {
         CacheMode=StiServerCacheMode.None,
    }

Adding this code solves the problem, but when I try to preview the print or output to Excel, it gives the following error:

ServerError: The report is not specified.

Is there a solution?

1 Answers

In case of printing in PDF mode, It's mandatory to set GetReport in Action when StiServerCacheMode is set to None:

       new StiNetCoreViewerOptions()
        {
            Server =
            {
                CacheMode = StiServerCacheMode.None,
                Controller = controller,
            },
            Actions =
            {
                GetReport = 'GetReport', 
                PrintReport = 'GetReport', //this line
                ViewerEvent = "ViewerEvent"
            },

Then you must change your already defined action to handle other requests like print or export:

public IActionResult GetReport(decimal receptionId)
    {
        StiReport report = new StiReport();
        report.Load(StiNetCoreHelper.MapPath(this, "~/...Report.mrt"));
            ...
        var requestParams = StiNetCoreViewer.GetRequestParams(this);
        switch (requestParams.Action)
        {
            case StiAction.GetReport: 
                return StiNetCoreViewer.GetReportResult(requestParams, report);

            default:
                return StiNetCoreViewer.ProcessRequestResult(requestParams, report);
        }
    }
Related