WPF Report Viewer: Send cookie to rest report service

4 posts, 0 answers
  1. Aleksandar
    Aleksandar avatar
    15 posts
    Member since:
    Nov 2012

    Posted 18 Jan Link to this post

    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?
  2. Todor
    Admin
    Todor avatar
    189 posts

    Posted 23 Jan Link to this post

    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
  3. Aleksandar
    Aleksandar avatar
    15 posts
    Member since:
    Nov 2012

    Posted 23 Jan in reply to Todor Link to this post

    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.
  4. Todor
    Admin
    Todor avatar
    189 posts

    Posted 26 Jan Link to this post

    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
Back to Top