Page 1 of 2

Angular with .net core - cache mode = none

Posted: Thu Jun 24, 2021 9:26 am
by ChristianMyksvoll
I have set up a minimal asp.net core project using nuget "Stimulsoft.Reports.Angular.NetCore" + a minimal Angular client app using npm package "stimulsoft-viewer-angular":
https://github.com/cmyksvoll/StimulsoftReportsTest

This works fine when Server CacheMode is set to ObjectCache (default). In my project I need to be able to access the server via a load balancer, so I cannot use caching on the server.
If I try setting CacheMode to None, my report variables are no longer showing (see attached screenshots).

Server code:

Code: Select all

    public class ViewerController : Controller
    {
        [HttpPost]
        public IActionResult InitViewer()
        {
            var requestParams = StiAngularViewer.GetRequestParams(this);
            var options = new StiAngularViewerOptions();
            options.Actions.ViewerEvent = "ViewerEvent";
            options.Server.CacheMode = StiServerCacheMode.None;
            return StiAngularViewer.ViewerDataResult(requestParams, options);
        }

        [HttpPost]
        public IActionResult ViewerEvent()
        {
            var requestParams = StiAngularViewer.GetRequestParams(this);

            if (requestParams.Action == StiAction.GetReport)
            {
                var report = StiReport.CreateNewReport();
                var path = StiAngularHelper.MapPath(this, $"Reports/TestReport.mrt");
                report.Load(path);
                return StiAngularViewer.GetReportResult(this, report);
            }

            return StiAngularViewer.ProcessRequestResult(this);
        }
    }

Re: Angular with .net core - cache mode = none

Posted: Thu Jun 24, 2021 12:21 pm
by Lech Kulikowski
Hello,

We need some additional time to investigate the issue, we will let you know about the result.

Thank you.

Re: Angular with .net core - cache mode = none

Posted: Mon Aug 09, 2021 6:10 am
by ChristianMyksvoll
Hi.
Any news on this issue? Have you been able to reproduce it?

Re: Angular with .net core - cache mode = none

Posted: Wed Aug 11, 2021 9:35 pm
by HighAley
Hello,

We have passed your information to our developers.
We will answer you by email when we get any result.

Thank you.

Re: Angular with .net core - cache mode = none

Posted: Thu Aug 12, 2021 11:28 am
by ChristianMyksvoll
We have also reproduced the same issue using Stimulsoft Reports on a plain MVC site.
When we set "options.Server.CacheMode = StiServerCacheMode.None" in the InitViewer method, the report parameters are not shown.

Re: Angular with .net core - cache mode = none

Posted: Thu Aug 12, 2021 12:41 pm
by Vadim
Hello.

Without cache you must load report on every request.
Please use next code:
public IActionResult ViewerEvent()
{
var requestParams = StiAngularViewer.GetRequestParams(this);

var report = StiReport.CreateNewReport();
var path = StiAngularHelper.MapPath(this, $"Reports/TestReport.mrt");
report.Load(path);

if (requestParams.Action == StiAction.GetReport)
{
return StiAngularViewer.GetReportResult(this, report);
}

return StiAngularViewer.ProcessRequestResult(requestParams, report);
}

Re: Angular with .net core - cache mode = none

Posted: Fri Aug 13, 2021 6:08 am
by ChristianMyksvoll
Thank you for your reply.
This solves my first basic issue: parameters not showing.
I have now updated the github repo with your suggested change: https://github.com/cmyksvoll/StimulsoftReportsTest

Now to my initial problem: parameters are not sent to the server for each request...
If I enter some text for "MyVariable" and then click Submit, the text is displayed in the resulting report. If I then change the zoom level from 100% to i.e. 75%, the text is no longer displayed in the report.

I have inspected the data that is sent to the server for each request:
1) On initial Submit, a ViewerEvent with "stiweb_action: Variables" is sent to the server including the base64 encoded "stiweb_parameters". This base64 encoded value contains "MyVariable" with the value I typed in.

2) When I change zoom level, a new ViewerEvent is sent to the server. This time with "stiweb_action: GetPages". This request also contains a base64 encoded "stiweb_parameters", but it does not contain "MyVariable".

See attached screenshots from Chrome DevTools.

Do you have a solution to this problem?

Re: Angular with .net core - cache mode = none

Posted: Fri Aug 13, 2021 6:11 am
by ChristianMyksvoll
Screenshot #2 - GetPages

Re: Angular with .net core - cache mode = none

Posted: Tue Aug 17, 2021 6:55 am
by Lech Kulikowski
Hello,

We need some additional time to investigate the issue, we will let you know about the result.

Thank you.

Re: Angular with .net core - cache mode = none

Posted: Tue Aug 17, 2021 8:04 am
by Vadim
Hello.

With disabled cache interactive report not works, you should use cache.
https://www.stimulsoft.com/en/documenta ... ashing.htm