Access “Application” object in ASP.Net MVC to store application wide variables

廉价感情. 提交于 2019-12-09 14:34:57

问题


How do I store a variable or object application wide in ASP.net MVC?

In regular ASP, you had the Application object and in ASP.net too apparently.

I'm using ASP.net MVC 2.


回答1:


In a controller you should be able to do this:

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


来源:https://stackoverflow.com/questions/3430839/access-application-object-in-asp-net-mvc-to-store-application-wide-variables

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