A way to get back lost session values

Discussion in 'ASP .Net' started by jbeteta@gmail.com, Oct 12, 2012.

  1. Guest

    My web application is losing session values for some reason, and it happens after an external web page is called. My application is quite big, so any major change would require too much time. My database is Oracle, not Sql Server.

    Would be there an alternative way to store value of those session variables? Actually I just need to keep two session variables.

    I was thinking to store those values in a Oracle table. Key would be SessionID. I read that SessionID keeps its value even after other session variables are recycled or lost, but I'm not complete sure.

    I was planning to put a function on each page, on Page_Load mewthod, checking if session variable is still there. If not, then go to Oracle table and retrieve it.

    Something like:

    If Session("MyVariable") Is dbNull.Value Then
    Seek it on Oracle table, using SessionID as Key, and assign to variable Var
    Session("MyVariable") = Var
    End If

    Do you think it would be OK? Can I trust SessionID?
    , Oct 12, 2012
    #1
    1. Advertising

  2. Brian Cryer Guest

    <> wrote in message
    news:...
    > My web application is losing session values for some reason, and it
    > happens after an external web page is called. My application is quite big,
    > so any major change would require too much time. My database is Oracle,
    > not Sql Server.
    >
    > Would be there an alternative way to store value of those session
    > variables? Actually I just need to keep two session variables.

    <snip>

    The obvious reason for losing session variables is that you are storing
    sessions in-proc and your application is recycling. So, on the assumption
    that you are using in-proc (the default) I would change to state server.
    Details here:
    http://www.cryer.co.uk/brian/mswinswdev/ms_vbnet_howto_session_store.htm

    Hope this helps.
    --
    Brian Cryer
    www.cryer.co.uk/brian
    Brian Cryer, Nov 1, 2012
    #2
    1. Advertising

  3. Guest

    Why not store them in cookies? they wouldn't expire unless you give them an expiration date


    Mike Lalonde / Kat Lalonde
    Sudbury, Ontario
    Jumlers.com catering
    , Nov 7, 2012
    #3
  4. Brian Cryer Guest

    <> wrote in message
    news:...
    > Why not store them in cookies? they wouldn't expire unless you give them
    > an expiration date


    Be aware that there are issues with using cookies:
    1. Cookies limit the amount of data you can store - although they are fine
    for small amounts of data.
    2. If they know what they are doing then cookies can be read by the user -
    although again this might or might not be an issue.
    3. If someone is keen enough then I think they can modify the value of a
    cookie, which then means that you need to verify that the value is legit.
    4. If the website is in Europe then you ought to worry about the (daft) EU
    cookie law.

    I'm not anti cookies. They have their uses and it is good to be aware of
    them.

    Better would be for the OP to identify why session data is being lost.
    However I expect we will never know because it doesn't look like the OP is
    responding.
    --
    Brian Cryer
    http://www.cryer.co.uk/brian
    Brian Cryer, Nov 7, 2012
    #4
    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. Alvin Bruney [MVP]

    Re: lost session values, not Session

    Alvin Bruney [MVP], Mar 2, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    424
    Alvin Bruney [MVP]
    Mar 2, 2004
  2. LiliA

    Session Values are lost

    LiliA, Jul 7, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    475
    =?Utf-8?B?bWFyc2hhbA==?=
    Jul 7, 2005
  3. =?Utf-8?B?U00=?=
    Replies:
    0
    Views:
    458
    =?Utf-8?B?U00=?=
    Feb 27, 2007
  4. =?Utf-8?B?U00=?=
    Replies:
    0
    Views:
    380
    =?Utf-8?B?U00=?=
    Feb 27, 2007
  5. Alex
    Replies:
    2
    Views:
    138
    Guest
    Oct 20, 2003
Loading...

Share This Page