This following code should run only on when page is unload or unexpected close or close window / tab, but right now it is firing on when page it load instead of Unload page.
I have to fire some event when page is closed or browser is closed !!
Code Behind :
Partial Class test
Inherits System.Web.UI.Page
Dim dbconn As Object = New DBConnection()
Private Sub test_Unload(sender As Object, e As EventArgs) Handles Me.Unload
dbconn.OpenConnection()
Dim cmd As SqlCommand = New SqlCommand("UPDATE test SET abc = '2' where sno = '123'", dbconn.con)
cmd.CommandType = CommandType.Text
cmd.ExecuteNonQuery()
dbconn.CloseConnection()
End Sub
End Class