Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

ASP error when loading Scripting.Dictionary object

Posted on 2013-01-18
2
Medium Priority
?
577 Views
Last Modified: 2013-01-23
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!
0
Comment
Question by:bbdesign
2 Comments
 
LVL 54

Accepted Solution

by:
Scott Fell,  EE MVE earned 2000 total points
ID: 38793546
Without seeing your complete code it is hard to say.  But the dictionary object is loading before any html.  If your ajax is loading after, that could be the reason.  You could put your array into a js file and then use javascript to lookup the translation.  Then the lookup is on the client side and would be more suitable for those types of requests.

Also, is it possible there are slight spelling issues or I can't remember if dictionary object is case sensitive.
0
 

Author Comment

by:bbdesign
ID: 38809739
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.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

876 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question