#1 2023-10-25 16:33:21

jhonattan471
Member
Registered: 2023-10-25

Embedding View error: Cannot change session ID. There is no session as

Hi, I'm new to ReportServer and I'm trying to implement it as a report server in our company.

The idea is to embed the reports into our HTML pages. To achieve this, I tried to follow the tutorial at: https://reportserver.net/en/guides/admi … a-the-URL/

I managed to embed reports using "7.11.3. Embedding Reports Without Login," but the "Embedding the Report Execution View" option is what we really need.

I was able to generate a working URL, for example: http://SERVER/reportserver/ReportServer.html#inlinereport/id:45368&type:preview

However, I can only access this route from a new browser tab. If I try to put it inside an iframe in the HTML, it prompts for login. But when I try to log in, I get the error:

'Cannot change session ID. There is no session associated with this request.
java.lang.IllegalStateException: Cannot change session ID. There is no session associated with this request.'

After reading the forum, I found some options for accessing it via a script. I tried an iframe that accesses this script:

import net.datenwerke.security.service.authenticator.AuthenticatorService
def userID = 25
def url = "http://SERVER/reportserver/ReportServer.html#inlinereport/id:45368&type:preview"
def authservice = GLOBALS.getInstance(AuthenticatorService.class)
authservice.setAuthenticated(userID)
httpResponse.sendRedirect(url)

However, when I access it via an iframe, it prompts for login and gives the same error. When I try to access it from a new tab, the report opens normally.

Offline

#2 2023-10-30 13:03:03

mcleverson
Member
Registered: 2023-09-10

Re: Embedding View error: Cannot change session ID. There is no session as

Hi there,

Any answer here?

We are about to adopt reportserver as our tool here including the enterprise edition. We need a help on this matter. Our trial is about to end and we could not embbed the report.

Could you please help us?

Thank u

Last edited by mcleverson (2023-10-30 13:03:46)

Offline

#3 2023-11-06 12:42:19

Felix
Moderator
Registered: 2022-08-01

Re: Embedding View error: Cannot change session ID. There is no session as

Hello and sorry for our late reply!

'Cannot change session ID. There is no session associated with this request.
java.lang.IllegalStateException: Cannot change session ID. There is no session associated with this request.'

We use a 'per browser' strategy to keep user logged in... therefore to test a different login but keep a second user logged in to observe or configure, is currently only possible by using two different browser (or the 'incognito window' if you're using chrome/firefox/...)

I'm not 100% sure how this is working using an IFrame... but regarding your problems the iframe seems to have no access to the current browser session

I managed to embed reports using "7.11.3. Embedding Reports Without Login," but the "Embedding the Report Execution View" option is what we really need.

Have you tried using an apikey?

Your approach using a custom login script on the other hand looks good wink

let me outline my solution (for an similar problem i was facing) :

1) Create a groovyscript just like this custom authentication but DO NOT use redirect!
2) gGive this groovyscript "web access" (so you don't have to be logged in to access this script) ==> If not... those session-errors or login-prompts may occure
3) After you called this script your client (browser) is now logged in with the user you want (best practice: use an user/password to restrict only access to your specific report) and you can send a second request to get the content you like

In this scenario you have a  "silent" login (no login prompt and a hard-coded user) and receive your content... maybe you have to embedd the responded "excecution view" directly into a <div> ... i'm not sure if the iFrame works in this case.

kind regards

Felix


Softwareentwickler bei Infofabrik

Offline

#4 2023-11-06 19:44:03

mcleverson
Member
Registered: 2023-09-10

Re: Embedding View error: Cannot change session ID. There is no session as

Hi there,

Thank you very much for your reply. Trying to answer your questions here:

Have you tried using an apikey?
Yes, and using apikey reportserver brought the report however it´s not what we want. We need to use execution view with ordering and options embedded in our SaaS.

About the solution you proposed:

We tried to create a simple Js script using the approach you mentioned:

<!DOCTYPE html>
<html>
<head>
  <title>Open URLs</title>
</head>
<body>
  <h1>Opening URLs in the Same Tab</h1>
  <iframe id="iframe" width="100%" height="500"></iframe>
  <script>
    // Function to load a URL in the iframe
    function loadURLInIframe(iframe, url) {
      iframe.src = 'about:blank'; // Clear the iframe's content
      setTimeout(() => {
        // Navigate the iframe to the new URL using a data URI
        iframe.src = 'data:text/html,' + encodeURIComponent(`<iframe src="${url}" width="100%" height="100%"></iframe>`);
      }, 100);
    }

    // Define your URLs
    const url1 = 'http://SERVER/reportserver/reportserver/scriptAccess?id=194240';
    const url2 = 'http://SERVER/reportserver/ReportServer.html#inlinereport/id:45368&p_grupoid:95E33F68-9BB9-4123-9A3D-48663D67CFAC&p_dataini:2023-05-01&p_datafim:2023-05-15&type:preview';

    // Load the first URL in the iframe
    loadURLInIframe(document.getElementById('iframe'), url1);

    // Wait for a delay (e.g., 3 seconds) and then load the second URL
    setTimeout(function() {
      loadURLInIframe(document.getElementById('iframe'), url2);
    }, 3000); // Adjust the delay in milliseconds as needed
  </script>
</body>
</html>

The problem here is that always we try to authenticate even without redirecting we have firstly a login screen from reportserver and secondly a session error message:

Cannot change session ID. There is no session associated with this request.

We need to solve this issue urgently as we are planning to use reportserver in our SaaS as explained before.

Could you please provide a working example? Is it possible to have a teams meeting to discuss briefly the issue and maybe try another approach?

Thank you.

Offline

#5 2023-11-10 10:55:42

mcleverson
Member
Registered: 2023-09-10

Re: Embedding View error: Cannot change session ID. There is no session as

No answer neither help through email or this forum. Unfortunately, we will use another tool.

Offline

Board footer

Powered by FluxBB