Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Object required session(...) error

Status
Not open for further replies.

bingxi

Programmer
Feb 22, 2002
4
US
Hi,

Our application is using session to hold a recordset object pass to different pages (I know this is not a good practice). When we do stress test with 3 concurrent users hitting the site, the error "Object required: 'session(...)' come up SOMETIME, not always. It happened on the line:

set rsTemp = session("sessionRs")

What I don't understand is the inconsistency. Why this happens? Does it caused by using session for recordset?


Thanks!


 
If the session times out or is otherwise abandoned then your variables will be destroyed.

Go through your web site and, before any place where you attempt to use a session variable that contains an object, add some code to make sure the object variable is set and, if not, either redirect the user or recreate the object.

Perhaps something like this:
Code:
IF session("sessionRs") Is Nothing THEN
  Response.Redirect "default.asp"
End If


Or maybe this:
Code:
IF session("sessionRs") Is Nothing THEN
  Set session("sessionRs") = Server.CreateObject("ADODB.Recordset")

  '** Other code to configure and populate the RS goes here
End If
 
Thanks, Sheco! Good suggestions.

But when we testing the site, it lasted 3 to 10 minutes so session should not timed out. And in code, there is nowhere to abandened the session. When we run the testing script, one time there were no problem, but would failed on this error other times. Why?
 
Maybe somewhere in the code the session variable gets set to Nothing?
 
I would set up an include file, and include it on every page within your site. The include file would do a simple response.write of all the session variables, I would also remove the redirect code temporarily. At least this way, you'll [hopefully] be able to pinpoint what is causing your session variable to expire (assuming that is whats happening)

I would also be curious to see how you're puttin this RS into your session variable. You may want to try assigning a test session variable taht simply equals the value 1 - just to eliminate the possibility of your empty sessionRS variable being somehow related to the fact that youre putting a recordset into it.

..just my two cents

All hail the INTERWEB!
 
Thanks!

My problem is I have to go through another client to do application formal strss test and I can't really adding testing code to test myself. The application works fine on my machine (development).


 
If you can't test anything on that machine, I can't imagine comnig up with a solution [sad]

All hail the INTERWEB!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top