Solved

ASP error when loading Scripting.Dictionary object

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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 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…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

920 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now