Don

Results 1 to 3 of 3

Thread: Don

  1. #1
    Don Safar Guest

    Default Don

    Have a problem with the onbeforeunload event. my application allows only one user to login. This is controlled through an sql table that is updated when a user logs in to the app. The main app runs from a frame window. If the user forgets to logout and closes the ie window, the sql table still shows him or her as logged in. I have developed a reset.asp script that allows them to clear the condition, but I would like to trap window close event with onbeforeunload and update table (log off user). The code is below<BR>Sub window_onbeforeunload<BR> &#039update registry to reflect organization maintenance complete<BR> &#039response.write "gets me a bug"<BR> dim mystr<BR> mystr="this is my string"<BR> top.location.href=("abend.asp")<BR>End Sub<BR>With debugger I can see that this routine gets executed, but debug hangs at the end sub statement (doesn&#039t go to abend.asp)<BR>&#039abend.asp<BR>&#060;%<BR> &#039Gets here browser exits without going through logoutasp<BR> dim SQL,RS,redurl<BR> set RS = server.CreateObject("ADODB.Recordset")<BR> &#039update registry to reflect that organization maintenance is not running...<BR> SQL = "update registry set [COA Mapping Running]=0,[COA Mapping Users]="&"&#039 &#039"<BR> set RS = session("conn").execute(SQL)<BR>%&#062;<BR> Any ideas on how to make this work

  2. #2
    Join Date
    Dec 1969
    Posts
    915

    Default RE: Don

    Why not use a Session_OnEnd Sub in your Global.asa File?<BR><BR>eg.<BR><BR>Sub Session_OnEnd<BR> dim SQL,RS,redurl<BR> set RS = server.CreateObject("ADODB.Recordset")<BR> &#039update registry to reflect that organization maintenance is not running...<BR> SQL = "update registry set [COA Mapping Running]=0,[COA Mapping Users]="&"&#039 &#039"<BR> set RS = session("conn").execute(SQL)<BR>End Sub

  3. #3
    Don Safar Guest

    Default RE: Don

    I tried that. Apparently if you exit the browser (by selecting file/close or clicking X on the window to close the browser) session_onend does not get executed.

Posting Permissions

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