473,705 Members | 5,086 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Sporadic error:" Object reference not set to an instance of an object."

Hello,

I have an ASP.Net application that uses the Wizard control to build a newsletter.
There are three steps in the wizard.

The customer's specific design data are loaded from a database in step 1 of the wizard and saved into a session variable.

In step 2, when the user clicks on a button, I load the design data from the session variable and these are saved for further handling in a HashTable.

The HashTable is defined in the general declarations of the page class:
Dim HT_HTMLData As Hashtable

The code to load the hashtable is as follows:
Private Function Send_TestMail() As Boolean

Try

HT_HTMLData = Session("HTMLDa ta") ' // Line X

.....

After loading the page on the production server, on some PC's everything is OK, no error message.

On other PC's I receive an "Object reference not set to an instance of an object" on line X. Some PC's receive this error more frequently than others. AFAIK, the error is not due to a timeout problem. The tests have been repeated and the inconsistency is consistant (... if I may say so ....)

Any help to solve this sporadic error will be most appreciated

Michel



Apr 3 '07 #1
3 2879
First thing, you should always be testing to see if an item such as a session variable is null before you attempt to access it.

How many steps does this wizard have? Something to keep in mind, no matter how quick you think a user should be able to fill out a form, you may find they'll take four times as long.It's amazing how long some people can take to enter data. I recently broke a form down into a number of simple pieces, informed the users that they had less then 20 minutes to perform some action to save their data, and there was still an attempt to enter the data in for an hour. If they take longer than the normal session timeout, you're going to loose all their session data. Instead of storing the data as a session variable, you could, perhaps, store it in the viewstate or as a hidden form field.

It could be also that the application is recycling and loosing the session data once the application pool is recycled.
--
Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006
"Michel Couche" <Co*****@Michel Couche.netwrote in message news:eO******** ******@TK2MSFTN GP02.phx.gbl...
Hello,

I have an ASP.Net application that uses the Wizard control to build a newsletter.
There are three steps in the wizard.

The customer's specific design data are loaded from a database in step 1 of the wizard and saved into a session variable.

In step 2, when the user clicks on a button, I load the design data from the session variable and these are saved for further handling in a HashTable.

The HashTable is defined in the general declarations of the page class:
Dim HT_HTMLData As Hashtable

The code to load the hashtable is as follows:
Private Function Send_TestMail() As Boolean

Try

HT_HTMLData = Session("HTMLDa ta") ' // Line X

....

After loading the page on the production server, on some PC's everything is OK, no error message.

On other PC's I receive an "Object reference not set to an instance of an object" on line X. Some PC's receive this error more frequently than others. AFAIK, the error is not due to a timeout problem. The tests have been repeated and the inconsistency is consistant (... if I may say so ....)

Any help to solve this sporadic error will be most appreciated

Michel



Apr 3 '07 #2
Sorry to be pedantic, but one does not "loose" one's Session Data. My pants
may be loose. But when my Session is gone, it's because I "lose" it (with one
"o").
Cheers,
Peter

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"Michel Couche" wrote:
Hello,

I have an ASP.Net application that uses the Wizard control to build a newsletter.
There are three steps in the wizard.

The customer's specific design data are loaded from a database in step 1 of the wizard and saved into a session variable.

In step 2, when the user clicks on a button, I load the design data from the session variable and these are saved for further handling in a HashTable.

The HashTable is defined in the general declarations of the page class:
Dim HT_HTMLData As Hashtable

The code to load the hashtable is as follows:
Private Function Send_TestMail() As Boolean

Try

HT_HTMLData = Session("HTMLDa ta") ' // Line X

.....

After loading the page on the production server, on some PC's everything is OK, no error message.

On other PC's I receive an "Object reference not set to an instance of an object" on line X. Some PC's receive this error more frequently than others. AFAIK, the error is not due to a timeout problem. The tests have been repeated and the inconsistency is consistant (... if I may say so ....)

Any help to solve this sporadic error will be most appreciated

Michel


Apr 3 '07 #3
Thank you Mark for your answer. I am sure if will help for this project but also I will use it as guidelines for future developments.
Michel

(to answer your question, it is a "3 steps" wizard)
"Mark Fitzpatrick" <ma******@fitzm e.comwrote in message news:ux******** ******@TK2MSFTN GP04.phx.gbl...
First thing, you should always be testing to see if an item such as a session variable is null before you attempt to access it.

How many steps does this wizard have? Something to keep in mind, no matter how quick you think a user should be able to fill out a form, you may find they'll take four times as long.It's amazing how long some people can take to enter data. I recently broke a form down into a number of simple pieces, informed the users that they had less then 20 minutes to perform some action to save their data, and there was still an attempt to enter the data in for an hour. If they take longer than the normal session timeout, you're going to loose all their session data. Instead of storing the data as a session variable, you could, perhaps, store it in the viewstate or as a hidden form field.

It could be also that the application is recycling and loosing the session data once the application pool is recycled.
--
Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006
"Michel Couche" <Co*****@Michel Couche.netwrote in message news:eO******** ******@TK2MSFTN GP02.phx.gbl...
Hello,

I have an ASP.Net application that uses the Wizard control to build a newsletter.
There are three steps in the wizard.

The customer's specific design data are loaded from a database in step 1 of the wizard and saved into a session variable.

In step 2, when the user clicks on a button, I load the design data from the session variable and these are saved for further handling in a HashTable.

The HashTable is defined in the general declarations of the page class:
Dim HT_HTMLData As Hashtable

The code to load the hashtable is as follows:
Private Function Send_TestMail() As Boolean

Try

HT_HTMLData = Session("HTMLDa ta") ' // Line X

....

After loading the page on the production server, on some PC's everything is OK, no error message.

On other PC's I receive an "Object reference not set to an instance of an object" on line X. Some PC's receive this error more frequently than others. AFAIK, the error is not due to a timeout problem. The tests have been repeated and the inconsistency is consistant (... if I may say so ...)

Any help to solve this sporadic error will be most appreciated

Michel



Apr 3 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1671
by: Paloma GarcĂ­a | last post by:
Dear all, I have created personalized configuration sections in my web project following the instructions described in this page http://msdn.microsoft.com/library/spa/default.asp?url=/library/SPA/cpguide/html/cpcondeclaringcustomconfigurationsections.asp The problem is that I using the same code and I get the error "Object reference not set to an instance of an object" in the line where I try to read the first parameter (in the page...
0
1203
by: Michael Chong | last post by:
I have an (exe) executable program created in VB.NET 2003 that calls to a MFC DLL written in VC++.NET 2003. I always get an error msg "NullReferenceException: Object Reference Not Set to an Instance of an Object" when my exe calls the following codes: in VB.NET Declare Function test Lib "C:\Cyob\IOComm\Debug\IOComm.dll" _ (ByVal a As Long, ByRef b As Integer) As Integer
18
28753
by: Microsoft | last post by:
When I try this in my code I alwas get an errormessage: "Object reference not set to an instance of an object" Dim g As System.Drawing.Graphics g.DrawString("Test", New Font("Arial", 12, FontStyle.Bold), Brushes.Black, 0, 0) Why is this? Marc
2
5309
by: Giovanni Bassi | last post by:
Hello All, I have encountered a problem. I am using visual inheritance and my base form adds an event handler on Form Load using the AddHandler Keyword. The problem is that if the Event Handler code is there, when I create the inherited form I get the error "Object Reference not set to an instance of an object". If it is not I get no error. I have tried leaving this code in the forms Sub New, but it produces the
0
2084
by: Martin Widmer | last post by:
Hello again! I have a datagridview control on my form and am using VS.Net 2005. One column is set up as combo box column, and when I try to set the datasource for that combobox column at design time in the properties section of VS, I get the error "object reference not set to instance of an object" and the only option is to click OK. I have not yet tried to set that datasource at runtime, but of course I could do that. But I don't...
2
1865
by: facole | last post by:
I'm new to the .net environment. What I'm trying to do is to have an html page call a .aspx application and pass certain information. I have a field in the html file <input type="text" name="UserName"> I'm call the .aspx program <form name="form1" method="POST" action="/application/test.aspx?">
2
6498
by: =?Utf-8?B?QmFkaXM=?= | last post by:
I'm doing a server side automation(I know it's bad but..) and its working fine locally and when accessing it from a remote machine using web browser is was giving me this error"Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80070005". so I configured the server using dcomcnfg as described in this link: http://support.microsoft.com/kb/288368/ and know...
2
1545
by: rksadhi | last post by:
/*Geting error ---object reference not set to an instance---at bold line----plz reply asap thanks in advance*/ cmd = new OleDbCommand ("SELECT e.emp_id,e.email, m.email AS Email FROM emp_details e INNER JOIN emp_details m ON e.spid = m.emp_id AND e.emp_id='" + e_id + "'",conn); dr=cmd.ExecuteReader(); if(dr.Read()) { strmail=dr.ToString(); strmailto=dr.ToString(); }
10
13318
RMWChaos
by: RMWChaos | last post by:
WinVista/IE7 I am getting some weird errors only in IE7, but not in FF2.0.0.8 or NN9. It even happens on this website when I click "Sign In". The error is: "A Runtime Error has occurred." "Line:xxx" "Error: Object expected" and Debug says: "Microsoft JScript runtime error: Object expected."
5
3831
by: dotnetnovice | last post by:
Hi everybody actually i was trying to insert some records in to SQL server through C# Wndows Aplication and during that i face an error "Object reference not set to an instance of an object." and need help from senors please explain me about it and also indicate it in my code. Here is my code in my Class Named DBHandler!!! using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Data.SqlClient;...
0
8690
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9139
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9034
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8979
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5933
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4440
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4704
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3138
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2491
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.