|
|
8000XXXX Errors Alerts ASP.NET 2.0 Classic ASP 1.0 COM / ActiveX Components Forms General Topics Date/Time Routines Email Scripts & Info Files/Directories & FSO Databases General Concepts Search Engine Optimization (SEO)Search | ASP FAQ Tutorials :: Classic ASP 1.0 :: COM / ActiveX Components :: Should I store objects in session/application scope? Should I store objects in session/application scope?NO. Many people seem tempted to store objects in the session, so that they don't have to create instances on each page. This is particularly true for connection objects and recordsets. They assume this is more efficient, but it is not. This is the absolute worst use of resources you can have (particularly with ADO objects) and will significantly reduce your application's scalability. See these articles for more details: KB #258939 Recommendations for Connecting to Databases Through IIS http://www.microsoft.com/mind/1198/ado/a... (tip #6) KB #176056 INFO: ADO/ASP Scalability FAQ Here are some other KB articles that should help clarify the issues at hand (I hope you didn't expect this to be light reading): KB #243544 INFO: Component Threading Model Summary Under Active Server Page KB #191979 PRB: VB Component Not Marked Apartment Produces ASP 0115 Error KB #243548 Design Guidelines for VB Components Under ASP KB #243543 Single-Threaded Apartment Objects in Session or Application Also, some gratuitous stuff from Charles Carroll: Session Overview &am... Databases & ... Global.asa Overkill Another possible outcome of storing an improperly threaded object in session or application scope is the following:
Make sure that your object is explicitly written for this scope before you attempt to utilize it this way. (Hint: no VB6 object is threaded correctly for use in session / application scope.) Note that it is possible to safely store a recordset in the session, by first converting it to its array form using GetRows(). See Article #2467 for an article on using GetRows(). There is at least one exception to this 'rule' - it is acceptable to store the free-threaded version of the MSXML DOM Document object in application scope, for example:
Related Articles Can I code ISAPI filters / extensions with Visual Basic? DLL: How do I avoid 'Permission Denied' when re-compiling? How do I detect browsers without components? How do I determine if a COM object is installed? How do I determine if a VBScript-based object exists? How do I generate PDF files from ASP? How do I generate RTF documents from ASP? How do I handle MD5 from ASP? How do I pass server-side values to a client-side ActiveX control? Should I close my objects and/or set them to nothing? Should I use CreateObject or Server.CreateObject? When does ASP release COM objects? Where can I get a shopping cart for my web site? Where can I get an updated version of browscap.ini? Why do I get 'Server.CreateObject Access Error'? Why do I get 8000401A errors? Why do I get 80040111 errors? Why do I get 80040112 / 8007045A errors? Why do I get 800401F3 / 800A01AD errors? Why do I get 80040460 errors? Why do I get 80040514 errors? Why do I get 8007000E errors? Why do I get 8007007E / 8007007F errors? Why do I get 80072EE2 errors? Why do I get 80072EE5 errors? Why do I get 800A0030 errors? Why do I get 800A005B errors? Why do I get 800A9C68 errors? Why do I get 800C0007 errors? Why does Browscap give me 'unknown' or tell me IE is Netscape? |