使用C#在asp.net中创建全局变量 [英] Creating global variables in asp.net using C#

查看:252
本文介绍了使用C#在asp.net中创建全局变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在窗口器件的应用previously我曾经建立在vb.net中使用模块的全局变量,但我发现,在C#中有模块的概念。所以我如何在C#中创建全局vaiables

I was working on window appication previously where i used to create global variables using modules in vb.net, but i found that in C# there is no concept of modules. so how can i create global vaiables in C#

推荐答案

您谈论一个web应用程序,所以我会建议你使用的会话状态如果你的变量将仅在一个会话中使用。我会建议你使用申请国家的应用范围的变量。

You're talking about a web application, so I will recommend you to use Session State if your variables will be used in one session only. And I will recommend you to use Application State for application wide variables.

这篇关于使用C#在asp.net中创建全局变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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