Link to home
Start Free TrialLog in
Avatar of Brad Bansner
Brad Bansner

asked on

ASP error when loading Scripting.Dictionary object

I'm occasionally getting errors that look like this:

Microsoft VBScript runtime
Object required: ''

The line where the error occurs looks something like this:

response.write(t.item("a"))

Open in new window


Earlier in the code, I setup the object like this:

set t=server.CreateObject("Scripting.Dictionary")
t.add a, "Text here"

Open in new window


The strange thing is, this works fine 99% of the time. But maybe 2-3 times a day, I get these errors reported (this is out of hundreds of daily users).

I am using the dictionary object pretty heavily, for language translations. The translations are stored in a database and then loaded into the dictionary object, then written to the browser. So I can easily change the text on the page to the correct language by loading the right translations into the dictionary object.

The ASP scripts where I am seeing these errors are loaded via AJAX, and several might be loaded into the main document simultaneously. But since they are distinct ASP scripts, I don't see why loading more than one at a time would cause any problem. The error sounds like the dictionary object doesn't exist, when it clearly does. Or that the object was closed.

I guess I am not really closing the dictionary objects at the end of the scripts. Could that be the problem?

Would appreciate any insight. Thank you!
ASKER CERTIFIED SOLUTION
Avatar of Scott Fell
Scott Fell
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Brad Bansner
Brad Bansner

ASKER

Thanks for your help. I think I figured this out. I believe user sessions were timing out. That caused the dictionary to not load (which was in an include file) so when the script continued... no dictionary object. This only happens once in a while if a user's session times out after 20 minutes of inactivity, so in the vast majority of cases, there was no problem.