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

前端 未结 7 1527
不思量自难忘°
不思量自难忘° 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:06

    You should be able to access this via HttpContext.Current.Application[], however MVC best practices would state that you should probably consider passing this through your View Model.

提交回复
热议问题