Server Error in '/' Application.
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.]
Microsoft.Reporting.WebForms.ReportViewer.get_ReportControlSession() +13
Microsoft.Reporting.WebForms.ReportViewerClientScript.SetViewerInfo(ReportViewer viewer, String reportAreaId, String promptAreaRowId, String docMapAreaId, String fixedTableId, String promptSplitterId, String docMapSplitterId, String docMapHeaderOverflowId, String directionCacheId, String browserModeCacheId) +1078
Microsoft.Reporting.WebForms.ReportViewer.OnPreRender(EventArgs e) +2696
System.Web.UI.Control.PreRenderRecursiveInternal() +90
System.Web.UI.Control.PreRenderRecursiveInternal() +163
System.Web.UI.Control.PreRenderRecursiveInternal() +163
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +906
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.8.4494.0
Base on information in stack trace above, non of it is from my own code.
Everything in code behind happen in Page_Load
and there is try catch
but it didn't catch any error. so I guess it's pointless for me to post the c# code.
This project is using visual studio 2015.
I am wondering where is the error come from.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="GRNCostReportWeekly.aspx.cs" Inherits="Report_GRNCostReportWeekly" %>
<%@ 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>GRN Cost Report Weekly</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<div>
<rsweb:reportviewer id="ReportViewer1" runat="server" font-names="Verdana" font-size="8pt" height="400px" width="400px">
<LocalReport ReportPath="report\GRNCostReportWeekly.rdlc">
<DataSources>
<rsweb:ReportDataSource DataSourceId="ObjectDataSource1" Name="DataSet_fn_Get_GRN_Cost_Report_PNA" />
<rsweb:ReportDataSource DataSourceId="ObjectDataSource2" Name="DataSet_fn_Get_GRN_Cost_Report_NonPNA" />
<rsweb:ReportDataSource DataSourceId="ObjectDataSource3" Name="DataSet_fn_Get_GRN_Cost_Report_ALL" />
<rsweb:ReportDataSource DataSourceId="ObjectDataSource4" Name="DataSet_fn_Get_GRN_Cost_Report_Summary" />
</DataSources>
</LocalReport>
</rsweb:reportviewer>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" OldValuesParameterFormatString="original_{0}"
SelectMethod="GetData" TypeName="DataSetTableAdapters.fn_Get_GRN_Cost_Report_PNATableAdapter" ConvertNullToDBNull="True">
<SelectParameters>
<asp:ControlParameter ControlID="hdSite" DefaultValue="" Name="Site" PropertyName="Value" Type="String" />
<asp:ControlParameter ControlID="hdPeriod" Name="Period" PropertyName="Value" Type="Int32" />
<asp:ControlParameter ControlID="hdProdGroup" DefaultValue="" Name="ProdGroup" PropertyName="Value" Type="String" />
</SelectParameters>
</asp:ObjectDataSource>
<asp:ObjectDataSource ID="ObjectDataSource2" runat="server" OldValuesParameterFormatString="original_{0}"
SelectMethod="GetData" TypeName="DataSetTableAdapters.fn_Get_GRN_Cost_Report_NonPNATableAdapter" ConvertNullToDBNull="True">
<SelectParameters>
<asp:ControlParameter ControlID="hdSite" DefaultValue="" Name="Site" PropertyName="Value" Type="String" />
<asp:ControlParameter ControlID="hdPeriod" Name="Period" PropertyName="Value" Type="Int32" />
<asp:ControlParameter ControlID="hdProdGroup" DefaultValue="" Name="ProdGroup" PropertyName="Value" Type="String" />
</SelectParameters>
</asp:ObjectDataSource>
<asp:ObjectDataSource ID="ObjectDataSource3" runat="server" OldValuesParameterFormatString="original_{0}"
SelectMethod="GetData" TypeName="DataSetTableAdapters.fn_Get_GRN_Cost_Report_ALLTableAdapter" ConvertNullToDBNull="True">
<SelectParameters>
<asp:ControlParameter ControlID="hdSite" DefaultValue="" Name="Site" PropertyName="Value" Type="String" />
<asp:ControlParameter ControlID="hdPeriod" Name="Period" PropertyName="Value" Type="Int32" />
<asp:ControlParameter ControlID="hdProdGroup" DefaultValue="" Name="ProdGroup" PropertyName="Value" Type="String" />
</SelectParameters>
</asp:ObjectDataSource>
<asp:ObjectDataSource ID="ObjectDataSource4" runat="server" OldValuesParameterFormatString="original_{0}"
SelectMethod="GetData" TypeName="DataSetTableAdapters.fn_Get_GRN_Cost_Report_SummaryTableAdapter" ConvertNullToDBNull="True">
<SelectParameters>
<asp:ControlParameter ControlID="hdSite" DefaultValue="" Name="Site" PropertyName="Value" Type="String" />
<asp:ControlParameter ControlID="hdPeriod" Name="Period" PropertyName="Value" Type="Int32" />
<asp:ControlParameter ControlID="hdProdGroup" DefaultValue="" Name="ProdGroup" PropertyName="Value" Type="String" />
</SelectParameters>
</asp:ObjectDataSource>
<br />
<br />
<asp:HiddenField ID="hdSite" runat="server" Visible="False" />
<asp:HiddenField ID="hdPeriod" runat="server" Visible="False" />
<asp:HiddenField ID="hdProdGroup" runat="server" Visible="False" />
<br />
</div>
</form>
</body>
</html>
Below is code from web.config related to report:
<httpHandlers>
<add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" validate="false"/>
</httpHandlers>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="Microsoft.ReportViewer.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
</assemblies>
<buildProviders>
<add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
</buildProviders>
</compilation>
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<handlers>
<add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
</handlers>
</system.webServer>