By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,693 Members | 1,280 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,693 IT Pros & Developers. It's quick & easy.

Application_End called everytimg I do a file IO

P: n/a

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.

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
Dim _sw As StreamWriter = _fi.CreateText
End If

Catch tae As Threading.ThreadAbortException

Catch ex As Exception
End Try


Feb 13 '06 #1
Share this Question
Share on Google+
1 Reply

P: n/a
Ok, got a fix for the problem, but I am not sure why. The fix is to use
another folder such as App_Data or any other user created folder for
the job.

It seems that when you try to write to a file in the
App_GlobalResources folder, it causes the application to crash, BUT
without throwing any errors.


Feb 13 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.