Web Development

General discussion


Difficult Question

By Shanghai Sam ·
In .asp, what would be the best way to write information to a table as the session ends? From what I understand, you can only define values to application and session objects in a session_onend sub, making it impossible to do this. I would be willing to use an array but I can't think of the best way to do this or how an array would work with an application variable.

I am kind of thinking about putting in array in an application object, but I'm not sure how to retrieve and store the information again, or if its even possible once a session_onend takes place.

This action MUST happen in session_onend.

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

Difficult Question

by MedievalDude In reply to Difficult Question

You are correct with what you've stated. You cannot do what you want to do. In fact, even coding session_onend subs do not always guarantee that they will fire when the session ends. So get rid of thoughts of all the wonderful things you could try doing at a session end and try to think of a way of saving your state BEFORE the session ends. Maybe you need a rinky-dink table setup somewhere in which you simply save data from time to time (maybe you have the page refresh itself every so often, and at that point, the page runs a short little ADO script that writes some session data out to the table for this particular user). I can tell that you very much want to write out things as the session ends, but you can't... so try to think of ways of writing out things during the session - someplace that can be used during the next session (like a table in a database).
If you're really in a pickle, share what you're trying to do, and maybe someone (even me, perhaps) will be able to help you accomplish it.

Collapse -

Difficult Question

by nikki96 In reply to Difficult Question

Since the user is leaving, they will not see any data written to a table, if you meant an HTML table. If you meant a database table, you can use the Server object to accomplish that task.
In the Session_OnEnd subroutine, you can use Server, Application, and Session objects.


Related Discussions

Related Forums