(Eric Marc Loebenberg)
1/9/2003 1:18:00 AM
Ryan,
This does not work since System.Web.HttpContext.Current is null in
both cases. System.Web.HttpContext is only assigned a value in events
triggered by HTTP requests, such as web forms or web services invoked
over the web.
As I stated in the original posting, there is no HTTP Context since
the code is executed through events triggered from file system events
as opposed to ASP http requests.
For now I have a workaround for each case, but they are not too
pretty.
For the file system event, I pass the HttpApplicationState to my
class's constructor and keep it in a class property so I have it when
the file sytem event is called.
For the web service method invoked from the file system event, I again
avoid Application variables (due to the null pointer error I get) and
use a shared static class variable within a separate class to manage
the global variable. It works well but I would have concurrency
problems if I had to do multiple writes through multiple threads
without the neat locking feature of Application variables.
Anyway, I still hope to find a way to access the Application variable
collection.