Allows the use of an object library's enumerated constants
throughout the application. For example, by including the ADO typelib, you can
use conn.OpenSchema(ADODB.adSchemaTables)
instead of conn.OpenSchema(20).
<!-- METADATA TYPE="TypeLib" { UUID="TypeLibID" | FILE="TypeLibFile" } VERSION="major.minor" LCID="LocaleID" -->
Although the version and locale can be requested, there will be no error if the server cannot find the variant specified.
You can add a descriptive name to the typelib declaration
before the METADATA keyword, to make it more
readable.
<!-- ADODB 2.5 METADATA TYPE="TypeLib" UUID="{00000205-0000-0010-8000-00AA006D2EA4}" -->
<!-- ADODB 2.6 METADATA TYPE="TypeLib" UUID="{00000206-0000-0010-8000-00AA006D2EA4}" -->
<!-- ADODB 2.7 METADATA TYPE="TypeLib" UUID="{EF53050B-882E-4776-B643-EDA472E8E3F2}" -->
<!-- ADODB 2.8 METADATA TYPE="TypeLib" UUID="{2A75196C-D9EB-4129-B803-931327F72D5C}" -->
<!-- ADOMD METADATA TYPE="TypeLib" UUID="{22813728-8BD3-11D0-B4EF-00A0C9138CA4}" -->
<!-- ADOX METADATA TYPE="TypeLib" UUID="{00000600-0000-0010-8000-00AA006D2EA4}" -->
<!-- CDONTS METADATA TYPE="TypeLib" UUID="{0E064ADD-9D99-11D0-ABE5-00AA0064D470}" -->
<!-- CDOSYS METADATA TYPE="TypeLib" UUID="{CD000000-8B95-11D1-82DB-00C04FB1625D}" -->
<!-- Scripting FSO METADATA TYPE="TypeLib" UUID="{420B2830-E718-11CF-893D-00A0C9054228}" -->
<!-- MSWC.IISLog METADATA TYPE="TypeLib" UUID="{B758F2F9-A3D6-11D1-8B9C-080009DCC2FA}" -->
<!-- MSXML2 METADATA TYPE="TypeLib" UUID="{F5078F18-C551-11D3-89B9-0000F81FE221}" -->
<!-- WinHttp5 METADATA TYPE="TypeLib" UUID="{C92A03CF-B92B-404F-9AC5-58664A592E4C}" -->
<!-- WinHttp5.1 METADATA TYPE="TypeLib" UUID="{662901FC-6951-4854-9EB2-D9A2570F2B2E}" -->Creates a COM object for the application or user session.that is available to the entire application. This allows you to set up a database connection, for example, and re-use it on each Active Server Page in the applicaiton, rather than re-connecting for each individual page.
<object runat="Server" scope="scope" id="varname" { progid="ProgID" | classid="ClassID" } ></object>
The scope for an object must be either Application (a single object for the entire
application) or Session (a copy of the object
for each user session). The object will be available in the global namespace
throughout the application, using the name varname, and in the
StaticObjects collection of the Application or Session
object (depending on the object's scope).
Creating and initializing an object once per application or
user is significantly faster than doing it repeatedly per page. For example,
creating an ADODB.Connection for the
application and connecting it to the database in the Application_onStart event, rather than on each
page, saves the user the time of creating and connecting (and disconnecting,
and releasing) the database connection on each page that uses the object.
Multiple application objects: database connections, commands, XSLT templates,
etc. taken together can make a site feel noticably faster.
Creating a single object for multiple pages also creates a single point of failure. For example, if a global database connection is unexpectedly disconnected, all the pages that use the object will be unable to access the database, unless they can detect the problem and reconnect.
Also, be aware that COM objects used this way must be threadsafe (able to run for multiple pages at once).
Application and session event handlers are defined in one or more script sections, each of which can use a different language. An event handler is a subroutine with one of the following names:
Application_onStart
Called the first time a page of the application is processed.
Application_onEnd
Called when the web service is shut down.
Session_onStart
Called the first time a user accesses an application that has sessions enabled. Used to initalize user-specific settings.
Session_onEnd
Called when the user session expires.
OnTransactionAbort
Called when the transaction fails, in an application that has enabled transactions.
OnTransactionCommit
Called when the transaction completes, in an application that has enabled transactions.
<!-- ADODB 2.5 METADATA TYPE="TypeLib" UUID="{00000205-0000-0010-8000-00AA006D2EA4}" --><objectrunat="Server"scope="Application"id="conn"progid="></object>ADODB.Connection"<scriptlanguage="VBScript"runat=">Server"SubApplication_onStartconn.Open"ConnectString"Application("MaxLogonTries")=3EndSub</script>