Hi, The other day I recived the following error when browsing my NEWS section: Object reference not set to an instance of an object ... Exception Details: System.NullReferenceException: Object reference not set to an instance of an object. ... Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.] NewsSearch.Page_Load(Object sender, EventArgs e) System.Web.UI.Control.OnLoad(EventArgs e) +67 System.Web.UI.Control.LoadRecursive() +35 System.Web.UI.Control.LoadRecursive() +98
System.Web.UI.Control.LoadRecursive() +98 System.Web.UI.Control.LoadRecursive() +98 System.Web.UI.Control.LoadRecursive() +98 System.Web.UI.Page.ProcessRequestMain() +731 Any ideas anyone? Cheers, Kalle Larsson
OK, I found the reason for the error (Y4K bug in News module according to previous posts). But, after upgrading, my News section went completely empty! Since I'm a newbe to DotNetNuke, I might miss something basic here, but a hint would be very much appreciated.
Do I need do reinitziate the module or something? Cheers, Kalle
"Object not set to an instance.."
---------------------------------
** it useally happens after you publish the web site..
The problem comes from the fact that the code files (C#) can not access one to another as you probably programmed them to do so..
The thing is that when publishing the web site, the compiler builds DLL files for EACH page and another seperate dll file for App_code.
If your Web application includes code that you want to share between pages - this code should be in the App_code directory!!
The principal that we have to put in mind is that:
'The content of application folders (except for the App_Themes folder) is NOT served in response to Web requests, but it CAN be ACCESSED from application code.'
You can store source code in the App_Code folder, and it will be automatically compiled at run time.
The resulting assembly is accessible to ANY other code in the Web application.
In order to change the software design to fit the new principal - do this:
1. cut all the code from the in-accessable page and switch it to -
public partial class Migrated_myClass : myClass
{
}
2. create the same myClass.cs file under the App_code directory, like that -
public partial class myClass
{
// all the code comes here...
}
kalle54
Member
20 Points
4 Posts
Object reference not set to an instance of an object
Jan 08, 2004 06:11 AM|LINK
kalle54
Member
20 Points
4 Posts
Re: Object reference not set to an instance of an object
Jan 08, 2004 07:01 AM|LINK
Rontch
Member
10 Points
2 Posts
Solution - Object reference not set to an instance of an object
Apr 05, 2006 12:27 AM|LINK
"Object not set to an instance.."
---------------------------------
** it useally happens after you publish the web site..
The problem comes from the fact that the code files (C#) can not access one to another as you probably programmed them to do so..
The thing is that when publishing the web site, the compiler builds DLL files for EACH page and another seperate dll file for App_code.
If your Web application includes code that you want to share between pages - this code should be in the App_code directory!!
The principal that we have to put in mind is that:
'The content of application folders (except for the App_Themes folder) is NOT served in response to Web requests, but it CAN be ACCESSED from application code.'
You can store source code in the App_Code folder, and it will be automatically compiled at run time.
The resulting assembly is accessible to ANY other code in the Web application.
In order to change the software design to fit the new principal - do this:
1. cut all the code from the in-accessable page and switch it to -
public partial class Migrated_myClass : myClass
{
}
2. create the same myClass.cs file under the App_code directory, like that -
public partial class myClass
{
// all the code comes here...
}