You can use the application session state for variables you want available
accross sessions (different users) and the session state for variables you
want available across a session (i.e. can be different values for different
users)
To use them, syntax is as follows:
To store a value in application state:
string GlobalVariable = "Some Value";
Application["GlobalVariable"] = GlobalVariable;
To retrieve a value from application state:
string RetrievedVariable = Convert.ToString(Application["GlobalVariable"]);
Session is the same syntax, but replace Application with Session.
Always remember that you can store different types in state, but they will
always be returned from state as an object, so you need to unbox them (i.e.
convert them to the type you put in there.
Also, its good practice to check the state variable is not null before
trying to retrieve it.
Hope that helps.
--
Regards,
Phillip Johnson (MCSD For .NET)
PJ Software Development
www.pjsoftwaredevelopment.com
"Husam" wrote:
Hi EveryBody:
How can I make my variable as global or variable that declared in all my
entire project.
For Example in Desktop application you can add your variable to the Module
to make declared for the entire project.
How can I do So in my web Application?
any help will be appreciated
regard's
Husam