HttpApplicationState not available in an MVC controller

痞子三分冷 提交于 2019-12-05 03:06:41

I think that in MVC3 you can get access to an actual HttpApplicationState object via the

HttpContext.ApplicationInstance

property. That is:

HttpApplicationState application = HttpContext.ApplicationInstance.Application 

In ASP.NET MVC2, i use

HttpContext.Application["foo"] = "bar";

and to get

HttpContext.Application["foo"]

You could use a static class with an internal dictionary and an indexer.

Also, have you tried HttpContext.Current.Application?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!