[2.0] Is there a session variable in c #?
Hi. Just want to know if there is a session variable in C# similar to that in PHP. In php there a session variable that once set, any other class could access that variable directly and also update values to that variable until it is destroyed.
Is that anything similar to that in C#?
Jennifer.
Re: [2.0] Is there a session variable in c #?
Yes:
Code:
Session["variable"] = value;
Re: [2.0] Is there a session variable in c #?
What is the namespace I need for this? Also it's for a window application form.
By the way, its been a while since i've seen you here.
Jennifer.
Re: [2.0] Is there a session variable in c #?
Oh. The Session array is a member of the Page object (or class--can't remember which). I assumed you were talking about an ASP.NET application.
For a desktop app, you can just make a public static property of any class. I do this in PHP too, rather than using global variables. This allows you to organise application settings logically.
Re: [2.0] Is there a session variable in c #?