在aspx.cs页面上访问global.asax变量 [英] Access a variable of global.asax on aspx.cs page

查看:80
本文介绍了在aspx.cs页面上访问global.asax变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



是否可以访问在aspx.cs页面上global.asax文件的session_start()方法中创建的变量?

提前谢谢!

问候,
Divya

Hi,

Is it possible to access a variable created in session_start() method of the global.asax file on a aspx.cs page ?

Thanks on advance !

Regards,
Divya

推荐答案

如果在session_start()方法范围内创建变量,则该变量仅在该方法内可用.

如果您将值存储在应用程序或会话状态中,则可以在整个应用程序中访问这些值.例如:

If you create a variable inside the scope of the session_start() method, it will only be available inside that method.

If you store a value in application or session state, those are accessible throughout your application. For example:

string myAppTitle = (string)Application["appTitle"]''



此处是入门书 [



Here''s a primer[^] on application state from MSDN.

Cheers.


这篇关于在aspx.cs页面上访问global.asax变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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