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

WPF Report Viewer: Send cookie to rest report service

3 Answers 44 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Aleksandar
Top achievements
Rank 1
Aleksandar asked on 18 Jan 2018, 03:07 PM
Our services are authenticated via an auth cookie that must be sent on every request. How can I attach the cookie to the http requests coming from the WPF report viewer?

3 Answers, 1 is accepted

Sort by
0
Todor
Telerik team
answered on 23 Jan 2018, 04:16 PM
Hi,

I will suggest you to use RestServiceConnectionInfo(string uri, string token) constructor to create the connection string to be used with the REST service. This way you will set up an Authorization Token that would be added automatically to the header with each request to the REST Service. The code can be added in the viewer constructor, after the call to the InitializeComponent() method.
public ReportViewerWindow1()
{           
    InitializeComponent();
 
    this.ReportViewer1.ReportEngineConnection = new Telerik.ReportViewer.Common.RestServiceConnectionInfo("RestServiceUrlHere", "AuthCookieHere").ConnectionString;
}


Regards,
Todor
Progress Telerik
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
0
Aleksandar
Top achievements
Rank 1
answered on 23 Jan 2018, 09:15 PM
If I'm understanding correctly, this won't actually send a cookie with the request but rather a header. We'd need to extract that header value (presumably the auth cookie string value) and decode/decrypt into an auth cookie on the server, then authorize. If there isn't a simple way to send a cookie, then I think this could work. Thanks, I'll let you know if I run into any issues.
0
Todor
Telerik team
answered on 26 Jan 2018, 01:36 PM
Hello Aleksandar,

Yes, this would indeed be a request header.
You cannot send a cookie directly from the WPF Report Viewer.

Regards,
Todor
Progress Telerik
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
Aleksandar
Top achievements
Rank 1
Answers by
Todor
Telerik team
Aleksandar
Top achievements
Rank 1
Share this question
or