请问asp.net MVC应用程序有变数? [英] Does asp.net MVC have Application variables?

查看:165
本文介绍了请问asp.net MVC应用程序有变数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我忙转换Web应用程序的MVC,并有保存在多个租户/帐户用来做​​事情有点更高效的应用程序变量的一些信息。

I am busy converting a web application to MVC and have some information saved to Application variables used across multiple tenants/accounts to make things a bit more efficient.

我实现MVC的一点是要保持事物的无状态越好,使sesion国家显然很有意义的,并且存在于MVC,但我们不希望只是转换应用Session变量,我们宁愿有一些更全球性和更安全。不要MVC应用有应用程序变量?我见过一些例子,使用缓存?这是现在的标准和如何强健/安全这是相对于应用程序/会话状态?

I realise the point of MVC is to keep things as stateless as possible, Sesion State obviously makes sense to have and exists in MVC but we dont want to just convert Application to Session variables as we would rather have something more global and more secure. Do MVC applications have Application Variables? I have seen some examples where caching is used? Is this now standard and How robust/secure is this compared to Application/Session State?

推荐答案

是的,你可以访问.NET MVC应用程序变量。具体方法如下:

Yes, you can access Application variables from .NET MVC. Here's how:

System.Web.HttpContext.Current.Application.Lock();
System.Web.HttpContext.Current.Application["Name"] = "Value";
System.Web.HttpContext.Current.Application.UnLock();

这篇关于请问asp.net MVC应用程序有变数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆