I ‘m new to classic asp and got a problem with the dictionary object. What i’m trying to do is when i POST a new key and value. it will dynamically add a new key and value into the dictionary and show it to the browser.
Whenever i POST a new key and value it doesn’t save what i’ve POSTed
<html>
<head>
</head>
<body>
<form method="post" action="form.asp">
<input type="text" id="key" name="key" /> <br />
<input type="text" id="value"name="value" />
<input type="submit" name="Submit" value="Submit" />
</form>
<%
Dim key
Dim value
key = request.form("key")
value = request.form("value")
Set d = Server.CreateObject("Scripting.Dictionary")
d.add key,value
Response.Write("<p>The value of the keys are:</p>")
a=d.Keys
for i = 0 To d.Count -1
s = s & a(i) & "<br />"
next
Response.Write(s)
%>
</body>
</html>
What you need is to store the Dictionary in Session then take it from there every time, add the item and update the Session:
This way every time user will post data, it will be added to the global storage.
Note, by default Session expires after 20 minutes of user being idle.