anugrah
asked on
session_end() of global.aspx does not execute on session.abandon() in vb.net code behind
hello everybody,
friends i am working on an application where i have to reset a flag in databse by a sql query whenever the session of a user is destroyed due to timeout or proper logout, so i used session.abandon() command in vb.net code behind and write the following code in session_en() function of global.aspx .
-------------------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------
Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
Dim connLogin As SqlConnection = New SqlConnection
connLogin = New SqlConnection(Configuratio nSettings. AppSetting s("Connect ionString" ))
If connLogin.State = ConnectionState.Closed Then
connLogin.Open()
Dim x = 17 'Session("IID")
Dim cmdUpdate As SqlCommand = New SqlCommand("update status set Flag='1' where IID='" & x & "'", connLogin)
cmdUpdate.ExecuteNonQuery( )
connLogin.Close()
Context.Response.Write("da tabase restored")
Else
Context.Response.Write("da tabase cant be restored")
End If
End Sub
-------------------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- -----
but any part of this function is not executed at all whenever session expires.
i have also given the session timeout value to 2 minutes in web.config file.
please help that exactly when and how this function can be executed as i need it at many more places.
thanks in advance.
friends i am working on an application where i have to reset a flag in databse by a sql query whenever the session of a user is destroyed due to timeout or proper logout, so i used session.abandon() command in vb.net code behind and write the following code in session_en() function of global.aspx .
--------------------------
Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
Dim connLogin As SqlConnection = New SqlConnection
connLogin = New SqlConnection(Configuratio
If connLogin.State = ConnectionState.Closed Then
connLogin.Open()
Dim x = 17 'Session("IID")
Dim cmdUpdate As SqlCommand = New SqlCommand("update status set Flag='1' where IID='" & x & "'", connLogin)
cmdUpdate.ExecuteNonQuery(
connLogin.Close()
Context.Response.Write("da
Else
Context.Response.Write("da
End If
End Sub
--------------------------
but any part of this function is not executed at all whenever session expires.
i have also given the session timeout value to 2 minutes in web.config file.
please help that exactly when and how this function can be executed as i need it at many more places.
thanks in advance.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
ya , softsolvers , thanks a lot your soluted helped me out of your problem
This is a common problem I see.