470,848 Members | 1,232 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,848 developers. It's quick & easy.

Help with FileSystemWatcher

I have a directory on my site that I keep a bunch of text files in. The
Application keeps the first line of each of these files in an
HttpApplicationState variable as a SortedList. When I add or modify one of
the files in this directory, I want to delete this HttpApplicationState
variable. I tried to do this using the following lines of code in

Private WithEvents poemfilewatcher As New
IO.FileSystemWatcher(HttpContext.Current.Server.Ma pPath("/poetry/poems/"))
Private Sub PoemDirModified(ByVal sender As Object, ByVal e As
System.IO.FileSystemEventArgs) Handles poemfilewatcher.Changed,
poemfilewatcher.Created, poemfilewatcher.Deleted




End Sub
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)

poemfilewatcher.IncludeSubdirectories = True

poemfilewatcher.EnableRaisingEvents = True

End Sub
However, when I add, delete, or modify a file in the directory it does seem
to delete the HttpApplicationState variable. Am I forgetting to do
something? Am I doing something wrong? Any help would be appreciated, or
possibly an example. Thanks.
Nathan Sokalski
Apr 8 '06 #1
0 872

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by cxw0106 | last post: by
2 posts views Thread by kmcnet | last post: by
reply views Thread by cxw0106 | last post: by
reply views Thread by cxw0106 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.