Results 1 to 8 of 8

Thread: losing session variables

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2000
    Location
    Reading, UK
    Posts
    870

    losing session variables

    Hi,

    I'm suffering from a weird problem and i'm just wondering if anybody else has had it.

    I am storing a number of variables as session objects. When i test my application locally, it works fine storing the information as it should do. When it is used by outside users however, the session objects lose their values. The problem occurs when my application opens a new browser window. I would have thought it could be this alone but the fact it works locally is puzzling.

    Any body any idea?

    many thanks
    Nick
    www.vb-tech.com
    .Net Freelance Development
    http://weblog.vb-tech.com/nick
    My blog

  2. #2
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538
    Here's a sample from the web.config file of one of my sites using session variables. Can you check you've got values in the highlighted parts below?
    Code:
    <authentication mode="Forms">
        <forms name=".CookieNameHere" loginUrl="LoginPage.aspx" protection="All" timeout="30"  path="/" />
    </authentication>
    
    <authorization>
        <deny users="?" />
    </authorization>
    
    <sessionState 
            mode="InProc"
            stateConnectionString="tcpip=192.168.1.102:8080"
            sqlConnectionString="data source=192.168.1.102;Trusted_Connection=yes"
            cookieless="false"  
            timeout="20" 
    />

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

  3. #3
    Frenzied Member Fishcake's Avatar
    Join Date
    Feb 2001
    Location
    Derby, UK
    Posts
    1,092
    nswan did you ever sort this out?

    I have a problem where my clients site requires a user to be authorised. The problem is that somehow from my clients machine they are losing session every couple of mins and so not being authorised are getting chucked back out to the log in screen.

    It works fine from here (both accessing same server), Any idea's at all as to how one keeps session as it should, but one connecting from the other machine won't keep sessionstate?

    Sorry thats not worded very well at all.

  4. #4
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267
    I made a work around for this before I even tried the sesion because I had the problem in old asp

    I am writeing sessionID, user name, ip, and some other junk to an xml file. So far everything seems fine even when the session is dropped and the user comesback the sessionID is normal the same and if it isn't they loggin, I clean the old seesion based on user name and we bump on down the line. I would just use SQL Server session state but no my host won't let me
    Magiaus

    If I helped give me some points.

  5. #5
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267
    isn't it weird that the sessionID is the same if the seesion is dropped or is that supposed to happen? It may just be in test because my computers have a static ip's but still....
    Magiaus

    If I helped give me some points.

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2000
    Location
    Reading, UK
    Posts
    870
    i think my problem was to do with the following scenario:

    A parent window opened another window(say for browsing for a file). This child window then redirected the parent window to another page before closing.

    I think it was opening different windows might cause new sessions but am not sure.

    Are you using Forms authentication when logging them on?
    www.vb-tech.com
    .Net Freelance Development
    http://weblog.vb-tech.com/nick
    My blog

  7. #7
    Frenzied Member Fishcake's Avatar
    Join Date
    Feb 2001
    Location
    Derby, UK
    Posts
    1,092
    Yep using Formsauthentication but got to the bottom of my problem now and why it was so hard to spot.

    We recently moved over to load-balanced servers. There was a problem with one of the 3 servers (the one the client was conneting too) whilst the one we connected to was working fine.

    Took me ages to think that we might not be connecting to the same server!

  8. #8
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267
    I don't see how a new window could cause a new session. The same ip, computer name and so on are there and the window opens inside the original seesion. I know that the window can't cause it because start your site get a session and close the site. Now go back with a new window if everything works properly you have session data still. By default that data is good for 20 min and the session id is found by checking ip, computer name and some other junk. I think.
    Magiaus

    If I helped give me some points.

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