Report Viewer Parsing Url Issue

4 posts, 0 answers
  1. Harsimrat
    Harsimrat avatar
    14 posts
    Member since:
    Nov 2014

    Posted 26 Mar Link to this post

    We have our reports hosted on Azure Blob Storage and would need to provide SAS token in the Url for them to open correctly. The behavior we are noticing with Report Viewer is very peculiar.

    The token we pass in the Url looks like this: sp=r&st=2019-03-26T21:39:32Z&se=2019-03-27T05:39:32Z&spr=https&sv=2018-03-28&sig=6BSlZTyohlqKSSHFRCSj2Y%2BpmIiQ4LOB2M%2FmHnKrIdc%3D&sr=b

    We looked at the request made by Report Viewer to download the file using Fiddler and it shows: sp=r&st=2019-03-26T21:39:32Z&se=2019-03-27T05:39:32Z&spr=https&sv=2018-03-28&sig=6BSlZTyohlqKSSHFRCSj2Y+pmIiQ4LOB2M/mHnKrIdc=&sr=b

    If you notice %2F is being translated as +, but for Azure that's how the SAS tokens work and the call gets rejected with 403.

    We thought maybe we can encode the Url but doing that we are running into this limitation.

    Unable to get report parameters.

    An error has occurred.
    The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.

    Any suggestions?

    Thanks,

    Harsimrat

     

  2. Todor
    Admin
    Todor avatar
    290 posts

    Posted 29 Mar Link to this post

    Hello Harsimrat,

    If I understood correctly, in the reportSource.report it is necessary to pass a special Token that contains substrings that resemble URL encoded characters (e.g. '%2F').

    I tested the scenario - I named a TRDP report "sp=r&st=2019-03-26T21:39:32Z&se=2019-03-27T05:39:32Z&spr=https&sv=2018-03-28&sig=6BSlZTyohlqKSSHFRCSj2Y%2BpmIiQ4LOB2M%2FmHnKrIdc%3D&sr=b.trdp" and passed it from the viewer to the REST Service. The built-in ReportFileResolver was not able to find the report, as its name was encoded - here is the error message in the viewer:

    Unable to get report parameters.
    Report 'sp%3Dr%26st%3D2019-03-26T21%3A39%3A32Z%26se%3D2019-03-27T05%3A39%3A32Z%26spr%3Dhttps%26sv%3D2018-03-28%26sig%3D6BSlZTyohlqKSSHFRCSj2Y%252BpmIiQ4LOB2M%252FmHnKrIdc%253D%26sr%3Db.trdp' cannot be resolved.

    In Fiddler the reportSource.report appeared correctly :

    {"report":"sp=r&st=2019-03-26T21:39:32Z&se=2019-03-27T05:39:32Z&spr=https&sv=2018-03-28&sig=6BSlZTyohlqKSSHFRCSj2Y%2BpmIiQ4LOB2M%2FmHnKrIdc%3D&sr=b.trdp","parameterValues":{}}

    Therefore, I created a custom report resolver. The report string was received as expected there, with no encodings or decodings. I was able to return a valid server-side ReportSource based on this string.
    I suggest to create custom resolver and handle report download there with custom code.

    Please, test the suggested approach and let us know whether it works for you. If the problem persists, please, elaborate on the exact scenario. Consider also opening a support ticket and sending us the implementation of the REST Service and the 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
  3. Harsimrat
    Harsimrat avatar
    14 posts
    Member since:
    Nov 2014

    Posted 31 Mar in reply to Todor Link to this post

    I think issue is when the SAS is parameter of the Url. This is what the Custom Resolver returned to the Report Viewer:

    Uri: "https://{value}.blob.core.windows.net/reports/1234567/MainITP.trdp?sp=r&st=2019-03-31T05:29:43Z&se=2019-03-31T13:29:43Z&spr=https&sv=2018-03-28&sig=VhsGwstPcMkSDkhNuS4pJHaKFUHHb7Z9dIu%2FbQGY5GM%3D&sr=b.trdp" - {id:b9e00f22-c97b-4dec-b94d-913e6399bbed;Authorization:Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIs...;}

    //What is  should be
    reports/1234567/MainITP.trdp?sp=r&st=2019-03-31T05:29:43Z&se=2019-03-31T13:29:43Z&spr=https&sv=2018-03-28&sig=VhsGwstPcMkSDkhNuS4pJHaKFUHHb7Z9dIu%2FbQGY5GM%3D&sr=b.trdp
    //What is becomes
     
    reports/1234567/MainITP.trdp?sp=r&st=2019-03-31T05:29:43Z&se=2019-03-31T13:29:43Z&spr=https&sv=2018-03-28&sig=VhsGwstPcMkSDkhNuS4pJHaKFUHHb7Z9dIu/bQGY5GM=&sr=b.trdp

     

     

  4. Alena
    Admin
    Alena avatar
    1049 posts

    Posted 03 Apr Link to this post

    Hello Harsimrat,

    I have some difficulties reproducing this behavior. Could you please provide steps to setup the scenario, so I can test further? Please send code snippets where you set this SAS parameter to be passed by the viewer. Alternatively, you can open a new support ticket and attach sample code there.

    Regards,
    Nasko
    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