This is a migrated thread and some comments may be shown as answers.

Geting a Report view template (cross origin resource)

1 Answer 287 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Andraz
Top achievements
Rank 1
Andraz asked on 28 Sep 2016, 07:36 AM

Hi,

I am working in .NET (MVC5). 

My problem is with cross-origin resource sharing. When I am trying to get telerikReportViewerTemplate-html in Chrome (IE and Edge are working OK) I am getting this error: 

"XMLHttpRequest cannot load http://localhost:56878/api/reports/resources/templates/telerikReportViewerTemplate-html. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:58343' is therefore not allowed access."

This is my code in JS calling report viewer:

            $('#reportViewer').telerik_ReportViewer({
                "serviceUrl": "http://localhost:56878/api/reports/",
                "scale": 1.0,
                "persistSession": false,
                "parametersAreaVisible": true,
                "documentMapVisible": true,
                "viewMode": "INTERACTIVE",
                "scaleMode": "SPECIFIC",
                "printMode": "AUTO_SELECT",
                "renderingBegin": "",
                "renderingEnd": "",
                "printBegin": "",
                "printEnd": "",
                "exportBegin": "",
                "exportEnd": "",
                "updateUi": "",
                "error": "",
                "pageReady": "",
                "ready": "",
                "parameterEditors": []
            });

 

How can I put a permissions in request header?

 

1 Answer, 1 is accepted

Sort by
0
Stef
Telerik team
answered on 28 Sep 2016, 11:55 AM
Hello Andraz,

The Reporting REST service is WebAPi based controller. You can enable CORS for it and if you need to provide authorized access to resources returned by the service, you can override the ReportsControllerBase methods.


I hope this helps.

Regards,
Stef
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
Andraz
Top achievements
Rank 1
Answers by
Stef
Telerik team
Share this question
or