Solved

ASP error when loading Scripting.Dictionary object

Posted on 2013-01-18
2
557 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
Comment Utility
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
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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 demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

771 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

11 Experts available now in Live!

Get 1:1 Help Now