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

前端 未结 1 1425
南方客
南方客 2021-02-19 15:00

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

1条回答
  •  星月不相逢
    2021-02-19 15:47

    In a controller you should be able to do this:

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

    0 讨论(0)
提交回复
热议问题