Global variable

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

Guest

Hi

I am a new comer of ASP.NET. I want to know how and where to set global variables in a project, such that these variable could be accessed in all aspx in the project? Please kindly advise

Yan
 
Depending on your needs, you can use either the Application object or the
Session object variables. Don't forget to clean up after these server-side
resources, if you do so.
Best bet I think is to create your own class to hold whatever variables you
need then instantiate that class and store its handler in a single
Application or Session variable, rather than having many Application or
Session variables.

Try it and see if it works.
Good luck,
/Js.

Yan said:
Hi,

I am a new comer of ASP.NET. I want to know how and where to set global
variables in a project, such that these variable could be accessed in all
aspx in the project? Please kindly advise.
 
Back
Top