Viewer - paging undefined, view mode undefined, zoom undefined

Stimulsoft Reports.WEB discussion
Lech Kulikowski
Posts: 6254
Joined: Tue Mar 20, 2018 5:34 am

Re: Viewer - paging undefined, view mode undefined, zoom undefined

Post by Lech Kulikowski »

Hello,

We have reproduced the issue, the NET Core process crashes without any specific errors, and not every time, we will try to solve the problem for the next release.

Thank you.
kubalak
Posts: 17
Joined: Fri Aug 09, 2019 4:22 pm

Re: Viewer - paging undefined, view mode undefined, zoom undefined

Post by kubalak »

Thanks. In the meantime, I run into another issue. OS X is my development environment. Production environment is Ubuntu 18.04 with Apache serving as reverse proxy and dotnet being run by supervisor. When I set it up, I get the following error when trying to open designer. Using the same sample project.

Uncaught TypeError: Cannot read property 'CloseForm.png' of undefined
at StiMobileDesigner.SmallButton (SimpleList?stiweb_component=Designer&stiweb_action=Resource&stiweb_cachemode=cache&stiweb_version=2019.3.4&stiweb_data=DesignerScripts:24811)
at StiMobileDesigner.StandartSmallButton (SimpleList?stiweb_component=Designer&stiweb_action=Resource&stiweb_cachemode=cache&stiweb_version=2019.3.4&stiweb_data=DesignerScripts:25229)
at StiMobileDesigner.BaseForm (SimpleList?stiweb_component=Designer&stiweb_action=Resource&stiweb_cachemode=cache&stiweb_version=2019.3.4&stiweb_data=DesignerScripts:30848)
at StiMobileDesigner.InitializeErrorMessageForm (SimpleList?stiweb_component=Designer&stiweb_action=Resource&stiweb_cachemode=cache&stiweb_version=2019.3.4&stiweb_data=DesignerScripts:31345)
at StiMobileDesigner.receveFromServer (SimpleList?stiweb_component=Designer&stiweb_action=Resource&stiweb_cachemode=cache&stiweb_version=2019.3.4&stiweb_data=DesignerScripts:279)
at XMLHttpRequest.xmlHttp.onreadystatechange (SimpleList?stiweb_component=Designer&stiweb_action=Resource&stiweb_cachemode=cache&stiweb_version=2019.3.4&stiweb_data=DesignerScripts:167)

Please would you have an idea how to overcome this? Many thanks!!
Lech Kulikowski
Posts: 6254
Joined: Tue Mar 20, 2018 5:34 am

Re: Viewer - paging undefined, view mode undefined, zoom undefined

Post by Lech Kulikowski »

Hello,

We have made some improvements and fixes. Please check the next build which will be within one or two days.

Thank you.
kubalak
Posts: 17
Joined: Fri Aug 09, 2019 4:22 pm

Re: Viewer - paging undefined, view mode undefined, zoom undefined

Post by kubalak »

Great!!! It works both on my OS X and behind the Apache reverse proxy on Ubuntu. Thank you!!

Now, the last thing is to turn anti-forgery token back on. In the sample project, in Startup.cs, I commented out lines 37-40 and line 44. The first block adds header and the second adds auto validation. When I turn it on, I get this error for the viewer:

Failed to load resource: the server responded with a status of 400 (Bad Request)
2:1 Uncaught SyntaxError: Unexpected token S in JSON at position 0
at JSON.parse (<anonymous>)
at 2?stiweb_component=Viewer&stiweb_action=Resource&stiweb_data=scripts&stiweb_theme=Office2013WhiteBlue&stiweb_loc=d3d3cm9vdC9SZXBvcnRzL2NzLnhtbA%3d%3d&stiweb_cachemode=cache&stiweb_version=2019.3.5:9171
at XMLHttpRequest.xmlHttp.onreadystatechange (2?stiweb_component=Viewer&stiweb_action=Resource&stiweb_data=scripts&stiweb_theme=Office2013WhiteBlue&stiweb_loc=d3d3cm9vdC9SZXBvcnRzL2NzLnhtbA%3d%3d&stiweb_cachemode=cache&stiweb_version=2019.3.5:931)

And only 400 for the designer.

Please, can it be done? Thanks again!
Lech Kulikowski
Posts: 6254
Joined: Tue Mar 20, 2018 5:34 am

Re: Viewer - paging undefined, view mode undefined, zoom undefined

Post by Lech Kulikowski »

Hello,

You can set the anti-forgery token вin the request header with adding the following JavaScript code on the viewer page after its initialization:

Code: Select all

<script>
    jsNetCoreViewer1.openConnection = function (http, url, responseType) {
        http.open("POST", url);
        http.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        http.responseType = responseType ? responseType : "text";

        // Set authorization header and other custom headers
        // http.setRequestHeader(...);
        // http.setRequestHeader(...);
    }
</script>
Thank you.
kubalak
Posts: 17
Joined: Fri Aug 09, 2019 4:22 pm

Re: Viewer - paging undefined, view mode undefined, zoom undefined

Post by kubalak »

Thanks but I still get the same error. Here is the code:

Code: Select all

@using Stimulsoft.Report.Mvc;
@using Stimulsoft.Report.Web;
@using Stimulsoft.System.Web.UI.WebControls;

@{
    ViewBag.Title = "Stimulsoft Reports.Web Demo";
}

@Html.StiNetCoreViewer("StiMvcViewer1", new StiNetCoreViewerOptions()
{
    Actions =
    {
        GetReport = "GetReport",
        ViewerEvent = "ViewerEvent"
    },
    Server = 
    {
        RequestTimeout = 300
    },
    Localization = "wwwroot/Reports/cs.xml",
    Appearance =
    {
        BackgroundColor = System.Drawing.Color.FromArgb(0xe8, 0xe8, 0xe8),
        ScrollbarsMode = true
    },
    Toolbar =
    {
        DisplayMode = StiToolbarDisplayMode.Simple,  
        ShowDesignButton = false,
        ViewMode = StiWebViewMode.SinglePage
    },
    Height = Unit.Pixel(1250)

})

<script>
    StiMvcViewer1.openConnection = function (http, url, responseType) {
        http.open("POST", url);
        http.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        http.responseType = responseType ? responseType : "text";

        // Set authorization header and other custom headers
        // http.setRequestHeader(...);
        // http.setRequestHeader(...);
    }
</script>





Lech Kulikowski
Posts: 6254
Joined: Tue Mar 20, 2018 5:34 am

Re: Viewer - paging undefined, view mode undefined, zoom undefined

Post by Lech Kulikowski »

Hello,

You should set JavaScript headers for antiforgery:
// Set authorization header and other custom headers
// http.setRequestHeader(...);
// http.setRequestHeader(...);

Thank you.
kubalak
Posts: 17
Joined: Fri Aug 09, 2019 4:22 pm

Re: Viewer - paging undefined, view mode undefined, zoom undefined

Post by kubalak »

I will play with it. Thank you!!
Andrew
Posts: 4104
Joined: Fri Jun 09, 2006 3:58 am

Re: Viewer - paging undefined, view mode undefined, zoom undefined

Post by Andrew »

Okay!
Post Reply