Angular with .net core - cache mode = none

Stimulsoft Reports.ANGULAR discussion
ChristianMyksvoll
Posts: 18
Joined: Thu Sep 22, 2011 8:42 am
Location: Norway

Angular with .net core - cache mode = none

Post 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);
        }
    }
Attachments
default-cache-mode.png
default-cache-mode.png (9.93 KiB) Viewed 10224 times
cache-mode-none.png
cache-mode-none.png (8.36 KiB) Viewed 10225 times
Lech Kulikowski
Posts: 6198
Joined: Tue Mar 20, 2018 5:34 am

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

Post by Lech Kulikowski »

Hello,

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

Thank you.
ChristianMyksvoll
Posts: 18
Joined: Thu Sep 22, 2011 8:42 am
Location: Norway

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

Post by ChristianMyksvoll »

Hi.
Any news on this issue? Have you been able to reproduce it?
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

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

Post by HighAley »

Hello,

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

Thank you.
ChristianMyksvoll
Posts: 18
Joined: Thu Sep 22, 2011 8:42 am
Location: Norway

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

Post 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.
Vadim
Posts: 362
Joined: Tue Apr 23, 2013 11:23 am

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

Post 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);
}
ChristianMyksvoll
Posts: 18
Joined: Thu Sep 22, 2011 8:42 am
Location: Norway

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

Post 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?
Attachments
stiweb-action-variables.png
stiweb-action-variables.png (50.59 KiB) Viewed 10009 times
ChristianMyksvoll
Posts: 18
Joined: Thu Sep 22, 2011 8:42 am
Location: Norway

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

Post by ChristianMyksvoll »

Screenshot #2 - GetPages
Attachments
stiweb-actions-getpages.png
stiweb-actions-getpages.png (49.81 KiB) Viewed 10008 times
Lech Kulikowski
Posts: 6198
Joined: Tue Mar 20, 2018 5:34 am

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

Post by Lech Kulikowski »

Hello,

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

Thank you.
Vadim
Posts: 362
Joined: Tue Apr 23, 2013 11:23 am

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

Post by Vadim »

Hello.

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