Hi,
My code:
Problem lies when I actually close the browser, the Session_OnEnd event is not triggeredCode:<script language="vbscript" runat="server"> Sub Session_OnStart Session("QID") = "" End Sub Sub Session_OnEnd Dim con Set con = Server.CreateObject("ADODB.Connection") con.open "DRIVER={SQL Server};SERVER=SIT;UID=sa;PWD=;DATABASE=counseling" sql = "UPDATE Question SET Answered = 'F', Picked = 'F' WHERE ID = "&Session("QID") on error resume next con.execute(sql) IF err.number = 0 THEN Session("id") = "" Session("user") = "" Session("role") = "" Session("school") = "" Session("origin") = "" 'logout = "/fypj/logout.asp" 'current = Request.ServerVariables("SCRIPT_NAME") 'IF strcmp(current, logout, 1) THEN ' response.redirect ("login.html") 'END IF END IF con.Close Set con = Nothing End Sub </script>
Any idea why?


Reply With Quote
Bookmarks