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
Mar 25, 2008 19:07
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
Mar 25, 2008 19:16
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
Mar 25, 2008 19:16
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.