Session variables

Discussion in 'ASP .Net' started by =?Utf-8?B?Qm9uag==?=, Apr 14, 2004.

  1. I see Session variables time out after 20 minutes (or whatever number of minutes you define)
    I want to have some variables that won't time out, but they only occupy very small amounts of data, say 10-20 bytes per user, so I think it won't too much of a performance impact to store it in the web server's memory. Would having hash tables as global variables using the SessionID as key work OK? Global variables and SessionIDs don't time out do they?
    =?Utf-8?B?Qm9uag==?=, Apr 14, 2004
    #1
    1. Advertising

  2. Hi,

    Basically I see two options:
    1- Use application variables, with a Hashtable and the userID is the key.
    2- Use a class with a static Hashtable or similar struct. it will be global
    to the application therefore will not expire with the section.

    Please note that both solutions assume that you are doing this for
    registered users, if you allow anonymous users and treat each session as a
    different user you have to do something else.


    Cheers,

    --
    Ignacio Machin,
    ignacio.machin AT dot.state.fl.us
    Florida Department Of Transportation

    "Bonj" <> wrote in message
    news:...
    > I see Session variables time out after 20 minutes (or whatever number of

    minutes you define).
    > I want to have some variables that won't time out, but they only occupy

    very small amounts of data, say 10-20 bytes per user, so I think it won't
    too much of a performance impact to store it in the web server's memory.
    Would having hash tables as global variables using the SessionID as key work
    OK? Global variables and SessionIDs don't time out do they?
    Ignacio Machin \( .NET/ C# MVP \), Apr 14, 2004
    #2
    1. Advertising

  3. =?Utf-8?B?Qm9uag==?=

    Hans Kesting Guest

    "Bonj" <> wrote in message news:...
    > I see Session variables time out after 20 minutes (or whatever number of minutes you define).
    > I want to have some variables that won't time out, but they only occupy very small amounts of data, say 10-20 bytes per user, so I

    think it won't too much of a performance impact to store it in the web server's memory. Would having hash tables as global variables
    using the SessionID as key work OK? Global variables and SessionIDs don't time out do they?

    It's not the session *variables* that time out, it's the *session* that will
    be removed (along with all stored values) after the user has done
    nothing (=no new page request) for 20 minutes.

    How long do you want to keep this data? Could you store it in
    a database?

    Hans Kesting
    Hans Kesting, Apr 14, 2004
    #3
  4. =?Utf-8?B?Qm9uag==?=

    Horatiu Ripa Guest

    All Session variables expires after 20 (or x minutes you choose) whatever
    type they have, also the corresponding SessionID of the expired Session. Use
    Application variables to store common variables.


    --
    Horatiu Ripa

    "Bonj" <> wrote in message
    news:...
    > I see Session variables time out after 20 minutes (or whatever number of

    minutes you define).
    > I want to have some variables that won't time out, but they only occupy

    very small amounts of data, say 10-20 bytes per user, so I think it won't
    too much of a performance impact to store it in the web server's memory.
    Would having hash tables as global variables using the SessionID as key work
    OK? Global variables and SessionIDs don't time out do they?
    Horatiu Ripa, Apr 14, 2004
    #4
  5. You could also look at storing this data in an encrypted cookie. Then you
    can set the timeout to whatever you wish with no server overhead.
    -mike
    MVP

    "Bonj" <> wrote in message
    news:...
    >I see Session variables time out after 20 minutes (or whatever number of
    >minutes you define).
    > I want to have some variables that won't time out, but they only occupy
    > very small amounts of data, say 10-20 bytes per user, so I think it won't
    > too much of a performance impact to store it in the web server's memory.
    > Would having hash tables as global variables using the SessionID as key
    > work OK? Global variables and SessionIDs don't time out do they?
    Michael Giagnocavo [MVP], Apr 14, 2004
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Earl Teigrob

    Global Session Variables and Session State

    Earl Teigrob, Dec 16, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    4,261
    Alvin Bruney
    Dec 17, 2003
  2. =?iso-8859-15?Q?Fabr=EDcio_de_Novaes_Kucinskis?=

    Session Variables assigned to the wrong session?

    =?iso-8859-15?Q?Fabr=EDcio_de_Novaes_Kucinskis?=, Jan 20, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    703
    Alvin Bruney [MVP]
    Jan 20, 2005
  3. Robert Faulkner
    Replies:
    0
    Views:
    868
    Robert Faulkner
    Jan 28, 2005
  4. Replies:
    1
    Views:
    923
  5. Replies:
    9
    Views:
    929
Loading...

Share This Page