I've got a problem moving a legacy web application based on .NET 2.0 and written in C#, to a new Windows 2012 Foundation Server. IIS 7.0 is already configured in ASP.NET classic mode.
Almost all pages are showing the following error.
I'd like to know what is the part of the source code that is generating this error, but the message displays [No relevant source lines]
.
Do you have some ideas?
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:
[No relevant source lines]
Source File: c:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\813bde8d\3a1aaa6a\App_Web_uc_elencoviaggi.ascx.572aee0e.phamg6cd.0.cs Line: 0
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.]
Makr.UI.PagamentiDataContext..ctor() +28
Makr.UI.Viaggi.UC_ElencoViaggi..ctor() +26
ASP.viaggi_uc_elencoviaggi_ascx..ctor() in c:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\813bde8d\3a1aaa6a\App_Web_uc_elencoviaggi.ascx.572aee0e.phamg6cd.0.cs:0
ASP.amministrazione_elencoviaggi_aspx.__BuildControlUC_ElencoViaggi1() in c:\inetpub\wwwroot\WebApp_Makr_Contabilita\Amministrazione\ElencoViaggi.aspx:6
ASP.amministrazione_elencoviaggi_aspx.__BuildControlContent2(Control __ctrl) in c:\inetpub\wwwroot\WebApp_Makr_Contabilita\Amministrazione\ElencoViaggi.aspx:5
System.Web.UI.CompiledTemplateBuilder.InstantiateIn(Control container) +12
ASP.master_amministrazione_master.__BuildControlContentPlaceHolder1() in c:\inetpub\wwwroot\WebApp_Makr_Contabilita\Master\Amministrazione.Master:150
ASP.master_amministrazione_master.__BuildControlform1() in c:\inetpub\wwwroot\WebApp_Makr_Contabilita\Master\Amministrazione.Master:13
ASP.master_amministrazione_master.__BuildControlTree(master_amministrazione_master __ctrl) in c:\inetpub\wwwroot\WebApp_Makr_Contabilita\Master\Amministrazione.Master:1
ASP.master_amministrazione_master.FrameworkInitialize() in c:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\813bde8d\3a1aaa6a\App_Web_9f0g2exr.0.cs:0
System.Web.UI.UserControl.InitializeAsUserControlInternal() +35
System.Web.UI.MasterPage.CreateMaster(TemplateControl owner, HttpContext context, VirtualPath masterPageFile, IDictionary contentTemplateCollection) +8696687
System.Web.UI.Page.get_Master() +51
System.Web.UI.Page.ApplyMasterPage() +15
System.Web.UI.Page.PerformPreInit() +45
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +282
Here is the code of the page:
<%@ Page Language="C#" EnableEventValidation="false" Theme="default" MasterPageFile="~/Master/Amministrazione.Master" AutoEventWireup="true" CodeBehind="ElencoViaggi.aspx.cs" Inherits="Makr.UI.Amministrazione.ElencoViaggi" Title="Untitled Page" %>
<%@ Register src="../Viaggi/UC_ElencoViaggi.ascx" tagname="UC_ElencoViaggi" tagprefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<uc1:UC_ElencoViaggi ID="UC_ElencoViaggi1" runat="server" />
</asp:Content>
Looking at the exception, it mentions an ascx
file. Can you view the source code of the ASP.NET app and see if there is an ascx
file used in a master page, or at least used in the aspx
pages?
It looks like that ascx
is doing something with an object and that object is null. Without seeing the code, it could be any reason why the object is null.