Latest web development tutorials

ASP Application Object

Work together to accomplish a task group ASP file called an application. Application object is used to put these files bundled together.


Application Object

An application on the Web may be a group of ASP files. The ASP files work together to accomplish a task. Application object is used to put these files bundled together.

Application object is used to store and access variables from any page, similar to the Session object. The difference is that all users share one Application object, Session object and user relationship is one to one.

Application objects there will be a lot of information in the application page uses (such as database connection information). You can access this information from any page. And you can also change the information in one place, then those changes will be automatically reflected on all pages.

Collections, methods, and events described in the Application object as follows:

set

集合 描述
Contents 包含所有通过脚本命令追加到应用程序中的项目。
StaticObjects 包含所有使用 HTML 的 <object> 标签追加到应用程序中的对象。

method

方法 描述
Contents.Remove 从 Contents 集合中删除一个项目。
Contents.RemoveAll() 从 Contents 集合中删除所有的项目。
Lock 防止其他的用户修改 Application 对象中的变量。
Unlock 使其他的用户可以修改 Application 对象中的变量(在被 Lock 方法锁定之后)。

event

事件 描述
Application_OnEnd 当所有用户的 session 都结束,并且应用程序结束时,此事件发生。
Application_OnStart 在第一个新的 session 被创建之前(即 Application 对象第一次被引用时),此事件会发生。