c# - ASP.NET session 已过期或找不到

标签 c# asp.net azure reportviewer

我在 Windows Azure 上部署了一个 asp.net(VS2010 - .NET 4.0) 应用程序。我正在尝试使用 .NET 报表查看器控件。我正在本地模式下运行报告。 报告工作正常并正确显示。当我尝试将其导出到 Excel/PDF/Word 时,出现此错误“ASP.NET session 已过期或无法找到”。

这是我的示例代码: 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();

最佳答案

我已经设置

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

此后,它可以在 Azure 上运行(至少对我来说)。

关于c# - ASP.NET session 已过期或找不到,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13015026/

相关文章:

asp.net - asp.net 中服务器端的确认框

azure - 如何通过 ssh 连接到 ACS Kubernetes 集群中的节点?

visual-studio-2010 - 构建自动部署到 Azure 的工具?

c# - VS2012代码覆盖率只分析测试dll

c# - 如何从这种一般情况下获取类型?

c# - 优化 GridView

asp.net - 如何在 asp.net 中设置动态元标记?

c# - 页面 _load "og:image"元标记 asp.net 上的更改

asp.net-mvc - 将静态网站从 Azure 存储帐户添加到 Asp.net MVC 应用程序?

c# - 如果 bool 为真则返回 int