M
Mufasa
I have code in my session_start to create a temp directory for the session.
On session_end it is supposed to delete the directory but doesn't seem to be
firing.
I've enclosed the code below.
Can anybody give me any suggestions as to why Session_End seems to not be
being fired?
TIA - J.
Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
'User only allowed 3 login attempts
Session("Num_of_Tries") = 3
Session("LoginCount") = 0
'Track if user is logged in or not
Session("Logged_IN") = "No"
Try
Dim lsDefaultDir As String = Server.MapPath("\")
lsDefaultDir = lsDefaultDir + "Temp"
Dim lsTempDir As String = lsDefaultDir + "\" +
Session.SessionID.ToString()
If (Not Directory.Exists(lsTempDir)) Then
Directory.CreateDirectory(lsTempDir)
End If
Catch ex As Exception
Dim lobjEMail As Marlin.Utilities.MarlinErrorHandler = New
Marlin.Utilities.MarlinErrorHandler
lobjEMail.ProcessError(ex, "Global.asax.vb_Session_Start",
"Global.asax.vb", False)
Dim lstemp As String
lstemp = ex.Message
End Try
End Sub
Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the session ends
Dim lsDefaultDir As String = Server.MapPath("\")
lsDefaultDir = lsDefaultDir + "Temp"
Dim lsTempDir As String = lsDefaultDir + "\" +
Session.SessionID.ToString()
If (Directory.Exists(lsTempDir)) Then
Directory.Delete(lsTempDir)
End If
End Sub
On session_end it is supposed to delete the directory but doesn't seem to be
firing.
I've enclosed the code below.
Can anybody give me any suggestions as to why Session_End seems to not be
being fired?
TIA - J.
Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
'User only allowed 3 login attempts
Session("Num_of_Tries") = 3
Session("LoginCount") = 0
'Track if user is logged in or not
Session("Logged_IN") = "No"
Try
Dim lsDefaultDir As String = Server.MapPath("\")
lsDefaultDir = lsDefaultDir + "Temp"
Dim lsTempDir As String = lsDefaultDir + "\" +
Session.SessionID.ToString()
If (Not Directory.Exists(lsTempDir)) Then
Directory.CreateDirectory(lsTempDir)
End If
Catch ex As Exception
Dim lobjEMail As Marlin.Utilities.MarlinErrorHandler = New
Marlin.Utilities.MarlinErrorHandler
lobjEMail.ProcessError(ex, "Global.asax.vb_Session_Start",
"Global.asax.vb", False)
Dim lstemp As String
lstemp = ex.Message
End Try
End Sub
Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the session ends
Dim lsDefaultDir As String = Server.MapPath("\")
lsDefaultDir = lsDefaultDir + "Temp"
Dim lsTempDir As String = lsDefaultDir + "\" +
Session.SessionID.ToString()
If (Directory.Exists(lsTempDir)) Then
Directory.Delete(lsTempDir)
End If
End Sub