R
Rykie
Hi,
I am hoping someone can shed some light on my problem here.
I have a .net2 web app, and the app has a logfile that sits under the
App_GlobalResources folder. The file is called log.txt. I use this file
to write events to, such as errors etc. My problem is that everytime I
write to it, it calls the Application_End evnt in Global.asax file. So
all my sessions and classes have to be re-initialised.
Here is the code I use to write to the file.
Try
If IsLoggedIn.Equals(False) Then
Server.Transfer("login.aspx", False)
Exit Sub
End If
Dim _fi As New
FileInfo(Server.MapPath("App_GlobalResources") & "\log.txt")
If _fi.Exists Then
_fi.Delete()
Dim _sw As StreamWriter = _fi.CreateText
_sw.WriteLine("")
_sw.Flush()
_sw.Close()
End If
Catch tae As Threading.ThreadAbortException
Catch ex As Exception
Response.Write(ex.ToString)
End Try
Thanks,
Rykie
I am hoping someone can shed some light on my problem here.
I have a .net2 web app, and the app has a logfile that sits under the
App_GlobalResources folder. The file is called log.txt. I use this file
to write events to, such as errors etc. My problem is that everytime I
write to it, it calls the Application_End evnt in Global.asax file. So
all my sessions and classes have to be re-initialised.
Here is the code I use to write to the file.
Try
If IsLoggedIn.Equals(False) Then
Server.Transfer("login.aspx", False)
Exit Sub
End If
Dim _fi As New
FileInfo(Server.MapPath("App_GlobalResources") & "\log.txt")
If _fi.Exists Then
_fi.Delete()
Dim _sw As StreamWriter = _fi.CreateText
_sw.WriteLine("")
_sw.Flush()
_sw.Close()
End If
Catch tae As Threading.ThreadAbortException
Catch ex As Exception
Response.Write(ex.ToString)
End Try
Thanks,
Rykie