当前位置: 动力学知识库 > 问答 > 编程问答 >

add item to application from controller in asp.net mvc

问题描述:

from my controller I want to assign a value to an application variable much like I would a session variable.

I assumed I could just use:

Application("MyValue") = "test"

网友答案:
HttpContext.Application["MyValue"] = test
网友答案:

If you are trying to use this to pass data from the controller to the view, use the ViewData.

ViewData("MyValue") = "test"

If not, please give more context as to what you are trying to accomplish.

分享给朋友:
您可能感兴趣的文章:
随机阅读: