How do you access application variables in asp.net mvc 3 razor views?

前端 未结 7 1535
不思量自难忘°
不思量自难忘° 2020-12-14 16:00

I set a Application variable in my global.asa.cs with:

    protected void Application_Start()
    {
        ...

        // load all application settings
            


        
7条回答
  •  没有蜡笔的小新
    2020-12-14 16:21

    I had this issue in an MVC controller and had to make fully qualified HttpContext for it to work ..

    System.Web.HttpContext.Current.Application["VarName"]
    

提交回复
热议问题