I’m in process of creating a Console Application, which needs to invode methods that heavily dependent on HttpContext. I could simulate the base HttpContext as well as the authentication, but I fail to set HttpContext.Current.Application. Is there any possibility to set the data in it?
There were couple of question on the same subject overe here, but couldn’t get a solution from either, and thus ended up posting another one here.
My target is to get this working.
HttpContext.Current.Application("PageDefinitionCache") = pageDefinitions
Any suggestions, please?
The cache lives inside the ASP.NET worker process, you cannot access it directly from a console application.
HttpContext.Currentisnullsince you don’t use the aspx.net worker process in a console application.Consider declaring a global variable in the console application to simulate the behavior of the
HttpContext.Current.Application.