javascript asp教程第十一课--Application 对象

2019-01-13 23:47:43王冬梅

Application Methods:

The two Application Methods are Lock() and Unlock(). Lock() blocks all other users from changing the Application variables. Unlock() releases control so that other users can change it. That's important on a larger site where multiple users may be trying to access the same page at the same time.

Application Events:

The two Application events are Application_OnStart() and Application_OnEnd(). These events are accessed in the global.asa. Let's repeat that script from lesson 09.

<OBJECT RUNAT=Server SCOPE=Session ID=MyInfo PROGID="MSWC.MyInfo">
</OBJECT>

<SCRIPT RUNAT="Server" LANGUAGE="JavaScript">
function Application_OnStart()
	{
	Application("someVariableName")="some value"
	}
function Application_OnEnd()
	{
	Application.Contents.RemoveAll()
	}
function Session_OnStart()
	{
	Session.Timeout=15
	}
function Session_OnEnd()
	{
	//Do Nothing
	}
</SCRIPT>

<!-- METADATA TYPE="typelib" 
FILE="C:Program FilesCommon FilesSystemadomsado15.dll" 
-->

Misc. Items:

Application.Contents has two methods of its own. Application.Contents.Remove("VariableName") and Application.Contents.RemoveAll().

You'll notice there are also Session Events in the global.asa. We'll deal with those in Lesson 12. You'll also notice a call to the ADO Library. We'll talk about that when we get to databases.

您可能感兴趣的文章:

ASP编程入门进阶(九):内置对象Applicationasp清空application的方法ASP javascript Application对象的Contents和StaticObjects做Cache的一些经验ASP.NET内置对象之Application对象asp.net Reporting Service在Web Application中的应用php和asp利用Shell.Application来执行程序的代码asp自带的内存缓存 applicationASP.NET中Application和Cache的区别分析asp.net错误处理Application_Error事件示例ASP.NET 使用application与session对象写的简单聊天室程序ASP基础入门第八篇(ASP内建对象Application和Session)