By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,191 Members | 1,411 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,191 IT Pros & Developers. It's quick & easy.

Session cleaning problem

P: n/a
At a summary page, I am trying to clean up Session.Contents so the user can
go back to the main page and not retain any unnecessary info.
I have entered this into my summary page, but it seems to only eliminate
every other or every third entry. If I refresh the page about 0 times
everything eventually clears out. Anyone know why it would do this?

I don't want to use Session.Abandon because there are a few Session.Contents
I want to retain, like usernams and passwords.

<%
----snip----
For Each objItem in Session.Contents
Session.Contents.Remove objItem
Next
----snip----
%>

Session.Contents are being added like this:

<%
----snip----
Session("uName") = uName 'put info into a session variable
Session("uEmail") = uEmail 'put info into a session variable
Session("uPass") = uPass 'put info into a session variable
Session("uDomain") = uDomain 'put info into a session variable
----snip----
%>

Thanks
--
__o
_-\<,
(_)/(_)____
Jul 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
I found my answer.
---------
arrSessionsToKeep = array("uName","uPass","uEmail","uDomain")
strSessionsToDelete = ""
for each objItem in Session.Contents
OkayToDelete = True
for each arrItem in arrSessionsToKeep
if arrItem = objItem Then
OkayToDelete = False
exit for
end if
next
if OkayToDelete then
strSessionsToDelete = strSessionsToDelete & objItem & ","
End If
next
arrSessionsToDelete = Split(strSessionsToDelete, ",")
for each arrItem in arrSessionsToDelete
Session.Contents.remove(CStr(arrItem))
next
---------
"Dan King" <da*******@earthlink.net> wrote in message
news:uQ**************@TK2MSFTNGP14.phx.gbl...
At a summary page, I am trying to clean up Session.Contents so the user can go back to the main page and not retain any unnecessary info.
I have entered this into my summary page, but it seems to only eliminate
every other or every third entry. If I refresh the page about 0 times
everything eventually clears out. Anyone know why it would do this?

I don't want to use Session.Abandon because there are a few Session.Contents I want to retain, like usernams and passwords.

<%
----snip----
For Each objItem in Session.Contents
Session.Contents.Remove objItem
Next
----snip----
%>

Session.Contents are being added like this:

<%
----snip----
Session("uName") = uName 'put info into a session variable
Session("uEmail") = uEmail 'put info into a session variable
Session("uPass") = uPass 'put info into a session variable
Session("uDomain") = uDomain 'put info into a session variable
----snip----
%>

Thanks
--
__o
_-\<,
(_)/(_)____

Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.