i am looping over session collection, but i want t...
# cfml-beginners
s
i am looping over session collection, but i want to keep the session kes but make all the values as empty, right now i can loop over session and do a sessionclear which also deletes the sesisonkeys
m
What is your end goal? Are you trying to clear out a session but not invalidate it? You could loop over the Session struct if ( not something i don't want to clear out ) Session[varName] = ""
s
i want to keep the sessions defined but do nt want to entirely remove it, just make them empty and logout so next they will login, the sessions will be setting up again
if you can share a sample that would be great to see how can i keep the keys and empty values, as i do not have the key names, because too much sessions are used
s
Copy code
for(k in session) {
        session[k]="";
    };
a
i want to keep the sessions defined but do nt want to entirely remove it, just make them empty and logout so next they will login, the sessions will be setting up again
This seems odd. Logging in again should not not be predicated on anything from the previous session. This sounds like a security issue waiting to happen. How come you think you need to do this? What is the circumstance that you are triggering the session-value-clear code. Also:
i am looping over session collection,
Next time, start with showing the code, not describing it, pls.