Hi all,

I have a project developed under Microsoft Visual Studio 2005 (with full updates), ASP.NET. The software uses a remote database to retrieve data. At the development process everything went fine. The project was working perfectly. But after installing publishing the project and adding the files to the web server the project seem to fail randomly. Even if I try to perform the same error on my machine to debug it just sems OK and no error occurs. My director advised me to close the connections after SQL queris and told me that it might cause the error so I have done it as:




Now when I try the same project again at the web server everythinh works fine for a moment and then fails for another moment. I have tried to figure out the reason or kind of error. But at a point when the project falls to error it simply might not on the next try. There are just a few clues to figure out what the problem is. First when a first kind of error happens I get the following message:

Server Error in '/bookings' 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.]
frmBrandOwner.Page_Load(Object sender, EventArgs e) +403
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +34
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1061

Another thing is that the program redirecs itself to the error page I made. But when I check the pages there only one point that it might be redirected to the error page. At the Loads event of every page I check the user login status and administration rights. To do so;

1. Check the user login:

a. Check if the session exists

b. Check if the session[username] exists


a. Check if the cookie exists

should be verified. At the administration rights section I am simply checking if the user level that is held in the session is smaller than a certain value in a DataHolder class which only holds private static data and updates itself while running at the first run of the program. So, it seems that the program might only fail if it does not read from the calss DataHolder, but since the project is on the remote machine when it causes the error, I can not debug it and it does not cause any problems while running locally.

Can anybody help me on solving the issue?