Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 440
friedkiwi Avatar asked Aug 07 '10 14:08

friedkiwi


1 Answers

In a controller you should be able to do this:

this.HttpContext.Application["foo"] = "bar";
like image 129
jwsample Avatar answered Sep 23 '22 00:09

jwsample