Click here to Skip to main content
16,001,074 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi to all,

Just want to ask if there's a maximum number of session variables per website
because I'd implemented a website build in asp.net using vb.
It works fine but suddenly user's experienced error
"object reference not set to an instance of an object."

I don't know where the error initiated and my stack trace doesn't give me the exact code that trigger the error.

Maybe, my session variables reach the maximum?

please help me guys...

thanks,

Enan
Posted
Comments
[no name] 5-Sep-12 12:05pm    
Probably has nothing to do with any max number of session variables. You get that error because you are trying to use an object or a method of an object that has not been instantiated. Since you have not provide any information relevant to that try reading through http://forums.aspfree.com/net-development-11/common-causes-of-object-reference-not-set-to-an-instance-45799.html and see if that helps.
ZurdoDev 5-Sep-12 12:42pm    
There is a limit but you'll also get an exception telling you that you have passed the limit, more in size than quantity I believe. I think your only option is to try and narrow down what is going on.
Hernan K. Cabrera 5-Sep-12 13:00pm    
Hi Wes,

Can I paste the codebehind here? I'm talking about 1 aspx and 2 user controls codebehind.
Hernan K. Cabrera 5-Sep-12 13:12pm    
It's ok if the error was consistently showing but the problem is its intermittent. :(

thanks,

Enan

Unless you've done something incredibly stupid, you're not going to hit that limit.

The error you're getting has nothing to do with it either. That error is because your code assumed you got back an object when you didn't and then you tried to set a property of execute a method on that object. Since the object was Nothing, there's nothing to set a property or execute a method on.

The stack trace will be extremely accurate and tell you in which method the error occured. It's your job to debug the code in that method and find the object that is Nothing.
 
Share this answer
 
I'd saved markers for every process so that I could validate where the error is originated and I've found out that the error is because of session variables crossed from other users. So, I google it and found this:

http://msdn.microsoft.com/en-us/magazine/cc163577.aspx

So, I add the line below to my web.config to address the problem in session variables crossing from different users.

httpRuntime enableKernelOutputCache="false"


thanks,


Enan
 
Share this answer
 

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