|
-
Jun 16th, 2007, 01:15 PM
#1
Thread Starter
Hyperactive Member
[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.
-
Jun 16th, 2007, 02:01 PM
#2
Re: [2.0] Is there a session variable in c #?
Yes:
Code:
Session["variable"] = value;
-
Jun 16th, 2007, 02:07 PM
#3
Thread Starter
Hyperactive Member
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.
-
Jun 16th, 2007, 02:11 PM
#4
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.
-
Jun 16th, 2007, 02:23 PM
#5
Thread Starter
Hyperactive Member
Re: [2.0] Is there a session variable in c #?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|