Global Session Variables and Session State

Discussion in 'ASP .Net' started by Earl Teigrob, Dec 16, 2003.

  1. Earl Teigrob

    Earl Teigrob Guest

    I what to create global variables that are based on the user session. I
    created a class that is instanced on session_start and hold all the users
    global variables within that class. This works great unil the user stays on
    the page for more then the timeout period (20 minutes or whatever) Then when
    they click a link the next page breaks because the current session has timed
    out . Because ASP.NET rebuilds the old page and then fires the event, if a
    session varialbe has timed out, then it messes up the loading of that page
    and causes an error. I sure wish that there was a way of delcaring an
    instance class that could be global accross all pages of the web site.

    Thanks for your input

    Earl
     
    Earl Teigrob, Dec 16, 2003
    #1
    1. Advertising

  2. Earl Teigrob

    Alvin Bruney Guest

    The problem you are having is related to transfering information from one
    page to another. Depending on how you transfer to another page, you need to
    re-adjust your class. Transfering methods are overloaded with the second
    parameter usually determining how the form variables and state is preserved.
    You need to use this as a guide for your class as well. For example, if you
    do a page transfer and set the preserve form to false, you need to clear out
    your class values and re-initialize to keep it in sync. I think that is all
    you are missing to make this work.

    --
    Regards,
    Alvin Bruney
    Got DotNet? Get it here...
    http://www.networkip.net/dotnet/tidbits/default.htm
    "Earl Teigrob" <> wrote in message
    news:...
    > I what to create global variables that are based on the user session. I
    > created a class that is instanced on session_start and hold all the users
    > global variables within that class. This works great unil the user stays

    on
    > the page for more then the timeout period (20 minutes or whatever) Then

    when
    > they click a link the next page breaks because the current session has

    timed
    > out . Because ASP.NET rebuilds the old page and then fires the event, if a
    > session varialbe has timed out, then it messes up the loading of that page
    > and causes an error. I sure wish that there was a way of delcaring an
    > instance class that could be global accross all pages of the web site.
    >
    > Thanks for your input
    >
    > Earl
    >
    >
     
    Alvin Bruney, Dec 17, 2003
    #2
    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. shamanthakamani
    Replies:
    1
    Views:
    3,548
    Natty Gur
    Nov 20, 2003
  2. Not Liking Dot Net Today
    Replies:
    0
    Views:
    672
    Not Liking Dot Net Today
    Apr 21, 2004
  3. Maciek
    Replies:
    0
    Views:
    8,303
    Maciek
    Sep 15, 2005
  4. jnickfl1
    Replies:
    0
    Views:
    631
    jnickfl1
    Sep 18, 2006
  5. archana
    Replies:
    0
    Views:
    369
    archana
    Mar 13, 2007
Loading...

Share This Page