asp.net/global.asax application variable

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

This is a real basic question.

How can I use a variable that I have included in global.asax in my webform
in a web application?

Thanks for your help in advance. Would appreciate any help.
 
Hi,

You can use the Application() object:

Application("MyVariable") = "A Test String"

Then in your app you can use Application("MyVariable") wherever you want and
change it whenever you want. Remember though that all users will share
this, so if you change it all the users will see the change immedieately.
If you want a seperate instance for each variable then use
Session("MyVariable") instead. Good luck! Ken.
 
Thanks Ken. I appreciate your help.


Ken Dopierala Jr. said:
Hi,

You can use the Application() object:

Application("MyVariable") = "A Test String"

Then in your app you can use Application("MyVariable") wherever you want and
change it whenever you want. Remember though that all users will share
this, so if you change it all the users will see the change immedieately.
If you want a seperate instance for each variable then use
Session("MyVariable") instead. Good luck! Ken.

--
Ken Dopierala Jr.
For great ASP.Net web hosting try:
http://www.webhost4life.com/default.asp?refid=Spinlight
If you sign up under me and need help, email me.
 
Back
Top