简体   繁体   中英

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.

<% 
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. msdn reference

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. And so far I'm only displaying my Session and Application variables. Regular variables seem to be ignored.

Regular variables are part of the current http request. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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