简体   繁体   English

经典ASP应用程序变量与常规变量

[英]Classic ASP Application Variables vs Regular Variables

I'm getting confused with what Application Variables are, related to regular variables I declare with my ASP project. 我对与我在ASP项目中声明的常规变量有关的Application Variables感到困惑。

<% 
Dim Greeting1 
Greeting1 = "This is a regular variable"
response.Write(Greeting1) 
response.Write("<br>")

Application("Greeting2") = "This is an Application Variable"   
response.Write(Application("Greeting2")) 
response.Write("<br>") 
%>

What is the difference between the two? 两者有什么区别? I've read that Application Variables, and session vars are considered to be part of Application.Contents collection. 我已经读过应用程序变量和会话变量被认为是Application.Contents集合的一部分。 msdn reference msdn参考

What are regular variables considered? 什么是常规变量?

I ask because i'm attempting to count/display all the variables my application has placed into memory. 我问是因为我试图计算/显示我的应用程序已放入内存的所有变量。 I'm using the code from PowerASP.net to do this. 我正在使用PowerASP.net中的代码来执行此操作。 And so far I'm only displaying my Session and Application variables. 到目前为止,我仅显示我的Session和Application变量。 Regular variables seem to be ignored. 常规变量似乎被忽略。

Regular variables are part of the current http request. 常规变量是当前http请求的一部分。 When the request is completed and the response sent, they no longer exist. 请求完成并发送响应后,它们将不再存在。 Application variables exist for the life of the application. 在应用程序的生存期内存在应用程序变量。

Also, the difference between an application variable and a session variable is that Application variables are shared for the whole application... everyone using the application sees the same variable, not just the one user or page. 同样,应用程序变量和会话变量之间的区别在于,应用程序变量是为整个应用程序共享的……使用该应用程序的每个人都可以看到相同的变量,而不仅仅是一个用户或页面。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM