kill the session objects on browser close

Results 1 to 5 of 5

Thread: kill the session objects on browser close

  1. #1
    Kams Guest

    Default kill the session objects on browser close

    I&#039m storing DLL objects in sessions in my ASP pages(ok,it&#039s bad,but..).Now, I should explicitly set these objects to nothing and abandon the session whenever user clicks the CLOSE button i&#039m providing(this i&#039m able to do) or when he just closes the browser.How do i capture the &#039browser close&#039 event?I tried to call a VBScript function with a Session.Abandon in &#039onUnload&#039 and &#039onBeforeUnload&#039 events of the BODY tag,but the function is executed client-side.This is killing the session before the ASP page is completely executed.<BR>Thanx in advance.

  2. #2
    Ian Stallings Guest

    Default RE: kill the session objects on browser close

    *<BR>rant - <BR>***************************<BR><BR>I hate to get off on a rant here but why are you storing<BR>DLL objects in the session object if you know it&#039s bad?<BR>It&#039s not only bad, it&#039s terrible. The ability to scale <BR>an application that uses this technique is nill, zip, zero. <BR>That app will crash. period. And who will they come too?<BR>you.<BR><BR>The point is just because you can do something in a <BR>programming language doesn&#039t mean you should.<BR>It&#039s kind off a moot point to close objects<BR>and abandon session to save memory if your going to<BR>use this technique knowing that it is incorrect.<BR><BR>***************************<BR>e nd rant<BR><BR><BR>not trying to be rude, just realistic<BR><BR>Ian S

  3. #3
    Join Date
    Dec 1969

    Default RE: kill the session objects on browser close

    Ok ok ok.. I know this is a stupid question BUT I gotta find out!<BR><BR>Why is it bad to store DLL in a session? DLL refer to CreateObject("")????<BR><BR>

  4. #4
    Ian S Guest

    Default RE: kill the session objects on browser close

    1.Because each time you create an object it lives in memory until<BR>the session is either terminated or times out. It is better<BR>to call the object when you need it and destroy it when your <BR>done on a page by page basis.<BR><BR><BR><BR>2.It wastes threads:<BR><BR><BR><BR>hth,<BR>Ian

  5. #5
    Join Date
    Dec 1969

    Default Anecdotal

    In developing a relatively simple app recently, I decided to keep my connection objects (I needed 2) in Session variables. Just in my development/testing on my local box, with only 1 other user accessing it, my memory usage went way out of control.<BR><BR>In retrospect, I was just doing it for the sake of doing it, and have since learned that it&#039s a really bad idea. Switched to creating/destroying it like you said in #1, and things are much, much better.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts