Access application state from scheduled job?

Vote:
 
Hi all, We have a scheduled job that works well when running manually, but casts nullreference exception when running automatically. The problem is that the Application object doesn't seem to be available when running by itself. Does anyone know if and how it's possible to access the Application state from the scheduled job? We would also need to call the Server.MapPath method - is there any way to access this without a HttpContext.Current object? Thanks, Christoffer
#15983
Jan 28, 2008 9:54
Vote:
 
Hi Christoffer! How do you access the application object? Something similar to this? Show us some code... HttpApplication ctx=(HttpApplication)HttpContext.Current.ApplicationInstance; I guess this can be a problem since it is invoked from another context by the scheduler service... Regards, Fredrik Haglund, INEXOR AB - http://blog.fredrikhaglund.se
#16748
Jan 29, 2008 10:40
Vote:
 
Hi, I guess the problem here is that the HttpContext.Current object is not available/null when running in the background thread. /Christoffer
#16749
Jan 29, 2008 18:49
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.