Creating Objects in Global.asa
Written by Eric Smith, Northstar Computer Systems LLC
Ever need to have an object around for the life of a user's session or the life of an ASP application? You could do it in the OnStart events of either the Session or Application objects; however, it's more efficient to declare the variable in the global.asa file outside of an event handler. Use the following code to declare a variable called dcnDB with Session-level scope:
<OBJECT RUNAT=Server SCOPE=Session ID=dcnDB PROGID="ADODB.Connection">
The benefit of this method is that the object is not created until you use it in your code. For Application-level objects, change the SCOPE parameter value to the word "Application".
Keywords: [
Uncategorized ASP Tips
]
Publication Date: 6/1/2000
|