There is no full-proof technique, but here is some probable solutions ...
When a user closes the browser, the session doesn't literally expire for a default time of 20 minutes. When the session expires the OnEnd event fires. You can code against this in the global.asax file like so ...
Dim conn As New SqlConnection(CONNECT_STRING)
Dim cmd As New SqlCommand( _
"insert into _DummyTbl (Text) values ('GLOBAL')", conn)
Now if you call the Session.Abandon method the OnEnd event will fire immediately. (NOT quite though, because I noticed that it took up to a few minutes at certain times for a record to appear into the database, but this is the best we are going to get.) Now we need some way to call the Session.Abandon method when a user closes their browser. This trick wont work in all web browsers, but you can tap into the onunload() event like so ... TESTA.ASPX
When the user closes the browser window at TestA.aspx, they are redirected to TestB.aspx ... TESTB.ASPX
Protected Overrides Sub OnLoad(ByVal e As System.EventArgs)
' End The Session
Dim s As String = ""
s &= "window.close();"
s &= "</script>"
On page load event of TestB.aspx, the code abandons the session then closes the browser immediately. The user never sees this page. In fact to the user, it looks like they closed TestA.aspx.
I hope the above information will be helpful. If you have any issues or concerns, please let me know. It's my pleasure to be of assistance