ASP.NET session has expired or could not be found

19,710

Solution 1

I have set

<rsweb:ReportViewer ... KeepSessionAlive="false" />

after this it worked on Azure (for me at least).

Solution 2

Please check this link.

This link works for me.

ASP.NET session has expired or could not be found -> Because the Session.SessionID changes (Reporting Services)

Thanks.

Solution 3

In my case; the ReportViewer control living in iframe an everything works fine, but in recent days my web site has stopped working, the reason was the google chrome security updates; Solution was set a subdomain for my report server, I.E. my web site living at https://app.myapp.com my report server living at https://reports.myapp.com.

NOTE: This solution is only applicable if you use an iframe for sow the report control and the sites live in different domains

Ref: Developers: Get Ready for New SameSite=None; Secure Cookie Settings Announcement: SameSite Cookie Handling and .NET Framework 4.7.2 Patch Availability on Azure App Service

Share:
19,710
user1765761
Author by

user1765761

Updated on June 06, 2022

Comments

  • user1765761
    user1765761 almost 2 years

    I have a asp.net(VS2010 - .NET 4.0) applications deployed on Windows Azure. I am trying to use .NET report viewer control. I am running the reports in Local Mode. Reports work fine and gets displayed correctly. When i try to export it to Excel/PDF/Word i get this error "ASP.NET session has expired or could not be found".

    Here is my Sample Code : ASP.NET

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="RxCloudReports.Default" EnableSessionState="True" %>
    
    <%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
        Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
        <script type="text/javascript">
    </script>
    </head>
    </head>
    <body>
        <form id="form1" runat="server" enctype="multipart/form-data">
        <asp:ScriptManager ID="ScriptManager1" runat="server">
            </asp:ScriptManager>
    
            <rsweb:ReportViewer ID="ReportViewer1" runat="server" ProcessingMode="Local" SizeToReportContent="true" AsyncRendering = "true" 
                         ShowPageNavigationControls="true"   ShowExportControls="true" ShowToolBar="true" >
    
            </rsweb:ReportViewer>
    </form>
    </body>
    </html>
    

    C#

    DataSet ds = GetDataSet(_ID, _Module);
    ReportViewer1.Reset();
    ReportViewer1.LocalReport.DataSources.Clear();
    ReportViewer1.ProcessingMode = ProcessingMode.Local;
    ReportViewer1.LocalReport.ReportPath = "Reports/Reports1.rdlc";
    ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("ReportDS", ds.Tables[0]));
    ReportViewer1.LocalReport.Refresh();