Results 1 to 6 of 6

Thread: session variables

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2004
    Posts
    8

    session variables

    Hey guys,

    I'm pretty knew in the web paradigm, and my big problem so far has been the session variables. They got lost for any apparently reason , and i'm saying that because when i debug the variable gets fill before to pass to the other page, but when i check the other page the value is null.

    do any of you guys have any pointer?

    sincerely

    Ben

    ps merry christmas !

  2. #2
    PowerPoster
    Join Date
    Nov 2001
    Location
    Trying to reach and stay in the cloud
    Posts
    2,089

    Re: session variables

    Well not sure what actually happensin your code, though just wanted to let you know, a new session variable is created each time you make some sort of a spelling mistake.

    for ex: session("MyLoginVar") and Session("MLoginVar") would be 2 variables giving you no error msges.

  3. #3

    Thread Starter
    New Member
    Join Date
    Dec 2004
    Posts
    8

    Re: session variables

    hey thanks, but believe me I checked that more than one time, and I actually have a code like this
    private sub AddtoSession(byval name as string,item as object)
    if not session(name) then session.remove(name)
    session.add(name,item)
    end sub

  4. #4
    PowerPoster
    Join Date
    Nov 2001
    Location
    Trying to reach and stay in the cloud
    Posts
    2,089

    Re: session variables

    I know that was dumb suggestion, but anyways i said it, becoz its sometimes we tend to make some really silly mistakes. no offence

    now what can coz the session varibles to get "destroyed"....maybe

    1. U are calling session.abandon?
    2. too long idle time between pages and so the session ends
    3. pages moving between "different" applications

    well just a few more guesses.

  5. #5
    Addicted Member
    Join Date
    Aug 2004
    Location
    Cape Town, South Africa
    Posts
    149

    Re: session variables

    From my experience sessionstate in vb.net is a bit buggy.

    Are you using frames ? Frames & session variables do not mix too well. Response.redirect also may sometimes cause a session to drop.

    The session also only exists for a single browser instance, so if you are redirecting to a new browser instance then the session will get lost.

    Do you have anymore explanation on what your code is doing ?

  6. #6
    Banned jhermiz's Avatar
    Join Date
    Jun 2002
    Location
    Antarctica
    Posts
    2,492

    Re: session variables

    Everytime you rebuild your project / solution the proper dll files "change"
    therefore session state is dead. Try it out for yourself open two browsers. In one compile your project and try then clicking something on your other browser open. You will notice that the session state has vanished. You can properly handle this via checking session state in the load event of your code, and redirect when necessary.

    This is a common problem that I too faced when I first started.

    Jon

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