Solved

Scripting.Dictionary in Application

Posted on 2001-08-01
10
292 Views
Last Modified: 2007-12-19
I'd like to create Scripting.Dictionary object in Application_OnStart() in order to get rid of endless calls to database for persistent enough information.
But it fails in accordance with MSDN docs and in fact.
Is there relaible way to create this object for Application?

TIA.
0
Comment
Question by:OMC2000
10 Comments
 
LVL 7

Expert Comment

by:John844
Comment Utility
I would not even try to create this object an application level of scope.  You are begging for trouble if you do.

You might can store the contents of the recordsets in a multidimensional array using rs.getrows().

John
0
 
LVL 1

Expert Comment

by:pjtt
Comment Utility
John844 is right. And this especially applies to the dictionary object, which good ol' Microsoft never quite got the threading model right for. That's one way to bring your server to its knees. Storing state information can be a pain sometimes, but there's a huge difference in performance between storing it in the database as opposed to an object in the application or multiple session variables.

Peter Tracey
Developer
http://www.25online.com/peter
0
 
LVL 2

Expert Comment

by:enkay022798
Comment Utility
I disagree with not using Dictionery objects at the application level. We used it vastly in one of my previous projects and never ran into any serious problems.

FOr the threading model to work just go into the registry and set the threading model for the Dictionery object to "Both".

All the best !
0
 
LVL 15

Author Comment

by:OMC2000
Comment Utility
enkay, the replacement of the "Apartment" with "Both" enables Scripting.Dictionary on Session level, but I still can't create this object on Application level.
What've I missed?
0
 
LVL 15

Author Comment

by:OMC2000
Comment Utility
enkay, the replacement of the "Apartment" with "Both" enables Scripting.Dictionary on Session level, but I still can't create this object on Application level.
What've I missed?
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 2

Expert Comment

by:enkay022798
Comment Utility
>>but I still can't create this object on Application level.

There shouldnt be a problem... where are you creating the object... what happens when it fails ? Do you get an error of any kind ?
0
 
LVL 15

Author Comment

by:OMC2000
Comment Utility
The following code in global.asa:

<SCRIPT LANGUAGE="JavaScript" RUNAT="Server">
...
function Application_OnStart() {
  var c = Server.CreateObject("Scripting.Dictionary");
  Application("eee") = c; // line 92
...
}
...
</SCRIPT>

causes the following error on the first call of any page:

"Application object error 'ASP 0197 : 80004005'

Disallowed object use

/DutchSite/global.asa, line 92

Cannot add object with apartment model behavior to the application intrinsic object.
"
0
 
LVL 2

Accepted Solution

by:
enkay022798 earned 100 total points
Comment Utility
Have you rebooted after changing the registry entry ? If the model is Both then why are you getting an error saying it is apartment threaded ?

Microsoft is sometimes strange ... any change to registry should be followed by a reboot.
0
 
LVL 15

Author Comment

by:OMC2000
Comment Utility
Thanks a lot, it really required reboot. I forgot that specific for IIS and other MS Stuff.
0
 
LVL 2

Expert Comment

by:enkay022798
Comment Utility
Glad you got it working :)
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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 …
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/…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

763 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

12 Experts available now in Live!

Get 1:1 Help Now