为了能够正常使用,必须把它们放到服务器上的一个虚拟应用程序内,并且把所提供的global.asa文件放到该应用程序的根目录中。最简单的办法是把global.asa文件放到缺省Web网站的根目录(缺省情况下是C:/InetPub/WWWRoot)中。
对任何已有的global.asa文件重命名是一个好办法,可以在以后对该文件进行恢复。
1. 显示Application集合的内容
ASPCounter对象是StaticObjects集合的一个成员(通过<OBJECT>元素进行定义),但是其余部份(由Server.CreateObject实例化)是Contents集合的成员。
可以看到使用global.asa例子网页放到这些集合中的值,这在前面已经看到:
<!-- Declare instance of the ASPCounter component with
application-level scope //-->
<OBJECT ID=”ASPCounter” RUNAT=”Server” SCOPE=”Applicatoin”
PROGID=”MSWC.Counters”>
</OBJECT>
...
...
<SCRIPT LANGUAGE=”VBScript” RUNAT=”Server”>
Sub Application_onStart()
'Create an instance of an ADO Connection with application-level scope
伊图教程网[www.etoow.com]
http://www.etoow.com/html/2009-04/1238618315.html
Set Application(“ADOConnection”) = Server.CreateObject(“ADODB.Connection”)
ASP中遍历和操作Application对象的集合
'http://www.etoow.com/html/2009-04/1238618315.html