Reputation: 932
I'm trying to create a Cache in classic ASP by using ASP Application Object. It turns out that every time I try to read the stored value, it returns null. I'm using Windows 7 with IIS version 7.5.7600.16385.
What do I suppose to do?
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<head>
</head>
<%
Application("test") = "Hello World!"
dim i
For Each i in Application.Contents
Response.Write(i & "<br>")
Next
dim k
For Each k in Application.StaticObjects
Response.Write(k & "<br>")
Next
%>
<body>
</body>
</html>
Upvotes: 0
Views: 413
Reputation: 3381
According to: http://msdn.microsoft.com/en-us/library/ms524512%28v=vs.90%29.aspx
Your example should be:
For Each i in Application.Contents
Response.Write(Application(i))
Next
That is: enumerating the collection returns the keys rather than the values.
Upvotes: 1
Reputation: 932
Ok, I'm NooB and I feel more Noob then ever now. What I was doing wrong is that the correct way to read the value is
Response.Write(Application("test"))
and to associate is
dim anything
anything = Application("test")
Response.Write(anything)
i'm sorry for make you all waste your time! Thanks!
Upvotes: 0