Results 1 to 5 of 5

Thread: [2.0] Is there a session variable in c #?

  1. #1

    Thread Starter
    Hyperactive Member drattansingh's Avatar
    Join Date
    Sep 2005
    Posts
    395

    [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.

  2. #2
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: [2.0] Is there a session variable in c #?

    Yes:
    Code:
    Session["variable"] = value;

  3. #3

    Thread Starter
    Hyperactive Member drattansingh's Avatar
    Join Date
    Sep 2005
    Posts
    395

    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.

  4. #4
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    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.

  5. #5

    Thread Starter
    Hyperactive Member drattansingh's Avatar
    Join Date
    Sep 2005
    Posts
    395

    Re: [2.0] Is there a session variable in c #?

    ok thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width