Solved

ASP error when loading Scripting.Dictionary object

Posted on 2013-01-18
2
564 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 52

Accepted Solution

by:
Scott Fell,  EE MVE earned 500 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

679 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