Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

session_onend help

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
HI,
I have the following to be done. Once a person logs on to a site, i am maintaining if the user is online/offline in Database. If he logs off the website by clicking a link, i am updating the DB accordingly. But the main problem is, What if the person closes the Browser window instead of logging off? In which case, he remains online according to the DB.
I tried of using the Session_OnEnd Event in Global.asa file, which i guess will fire once the session of the user ends, but this dosent work, or does it? if you can give me any suggestions, it would be great...as i am in urgent need of this.


Thanks

Vikram
 
The Session_OnEnd Event in Global.asa file, will fire once the session of the user ends.It definitely works.The session of a user does not end as soon as the user closes the browser window.The default timeout of a session is 20 minsutes.The session of a user will end only 20 minutes after the session starts.The Session_onEnd method in global.asa is executed only after that.The duration of a session can be increased or decreased by using the Session.Timeout Property.
 
Hi, I have a problem probably a small one for many of all of you. Well. I want to use the window.close() script to close 2 window in the same time. Is that code already exist or do I have to creater one?

tx

a newbie :eek:)
 
What justryingtohelp (appropriate handle) says is completely true. This is a copy of my Session_onEnd function in my global.asa and this works fine:

Sub Session_onEnd

Dim Conn, sql

' Connect to the Login Database
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "DSN=Login"

' Generate the SQL command to log the access in the User Tracking Table
sql = "UPDATE ""User Tracking"" SET [Logout Time] = '" & date & " " & time & "' WHERE SessionID = '"
sql = sql & Session.SessionID & "'"

' Execute the SQL command
Conn.Execute sql, , 1

Conn.Close : set Conn = nothing

End Sub


This gets executed either when the user clicks a logout button or the session times out. Mighty :)
 
Poupette

What you are asking is actually a new thread. You will get much better results if you start a new thread on this topic, as opposed to asking your question in the middle of this one.
 
Weel, by searching and searching, ive found something,. very simple, in javascript.

here's the code for the page :

<script language=&quot;JavaScript&quot;>
<!--
function close_window2() {
self.parent.opener.location.replace('close.html');
window.parent.close();
}
//-->
</script>


and in a close.html page, ive only set onload=window.close and it works very good !

 
Ive got it !
Well, by searching and searching, ive found something,. very simple, in javascript.

here's the code for the page :

<script language=&quot;JavaScript&quot;>
<!--
function close_window2() {
self.parent.opener.location.replace('close.html');
window.parent.close();
}
//-->
</script>


and in a close.html page, ive only set onload=window.close and it works very good !

Thanks to you guy !
Poupette

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top