Click here to Skip to main content
15,899,124 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
This error is coming when i have uploaded the website on server

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:


Line 43: Label1.Text = "View All Blogs";
Line 44:
Line 45: ent.GetEntryList(Repeater1);
Line 46: }
Line 47:

Source File: e:\HostingSpaces\ims4maths\blog.ims4maths.com\wwwroot\Default.aspx.cs Line: 45

Stack Trace:


[NullReferenceException: Object reference not set to an instance of an object.]
IMS.DAL.Functions..cctor() in D:\Saba\Final IMS Blog\IMS.DAL\Functions.cs:20

[TypeInitializationException: The type initializer for 'IMS.DAL.Functions' threw an exception.]
IMS.DAL.Functions.ExecuteSelectCommand(String CommandName) in D:\Saba\Final IMS Blog\IMS.DAL\Functions.cs:55
IMS.DAL.EntriesDb.GetEntryList() in D:\Saba\Final IMS Blog\IMS.DAL\EntriesDb.cs:38
IMS.BLL.EntriesAction.GetEntryList(Repeater rep) in D:\Saba\Final IMS Blog\IMS.BLL\EntriesAction.cs:39
Default.ShowAllBlogs() in e:\HostingSpaces\ims4maths\blog.ims4maths.com\wwwroot\Default.aspx.cs:45
Default.Page_Load(Object sender, EventArgs e) in e:\HostingSpaces\ims4maths\blog.ims4maths.com\wwwroot\Default.aspx.cs:37
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +51
System.Web.UI.Control.OnLoad(EventArgs e) +92
System.Web.UI.Control.LoadRecursive() +54
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +772
Posted
Updated 25-Jul-14 23:26pm
v2
Comments
I guess the Repeater is null.

1 solution

The program defines the Main entry point. The string reference variable is assigned to the null literal. Next, the Length property is accessed on the string reference. The program compiles correctly, but will always throw an execution.

Note:
You cannot access an instance property like Length on a null reference. An exception will always occur.


You need to debug your program and check for all possible null values.

[Update]
Check ent and Repeater1 object for null values before using it.

   --Amy
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900