gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-04 02:15:08 25 4
gpt4 key购买 nike

我在 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com