How do I find the application path in an HttpModule timer?
Here's a pickle (to me, anyway)... How do you determine an application's path from an HttpModule inside of a running timer? I tried the obvious by passing in the application context and looking it up from Request.ApplicationPath, but that works only when the app first starts (which makes sense since there is no request when the timer fires). Code looks something like this...
public class Module : IHttpModule
public void Init(HttpApplication application)
timer = new Timer(new TimerCallback(this.myMethod),
application.Context, TimeSpan.Zero, new TimeSpan(0, 15, 0));
static Timer timer;
private void myMethod(object sender)
// this works the first time, but not on subsequent calls
string path = ((HttpContext)sender).Request.ApplicationPath;
public void Dispose()