Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Classic ASP and Session Issue

  • 11-05-2007 5:22pm
    #1
    Closed Accounts Posts: 522 ✭✭✭


    I have a small application that stores some information in a session across a few pages. It was all working just dandy locally but on the live server, the sessions were acting strangely.

    When i log in it stores my userid for example and goes to the next page (Page 1) and shows what i can log into, then i go to other pages, i return to the Page 1, all the session info is gone. I refresh and it is all back again.

    Weird thing is, i have taken to printing out the session ID and time, and when the session id info goes, it actually displays a completely different session ID and the time is in a different format.

    Has anyone any ideas, this is driving me barmy.

    thanks


Comments

  • Closed Accounts Posts: 831 ✭✭✭Laslo


    How are you setting your sessions? Are you using global.asa? Are you setting your user id session based on a script that pulls it from a database? Does this function get recalled when you go back to the homepage?


  • Closed Accounts Posts: 1,200 ✭✭✭louie


    do you destroy the session by any chance on the next page or anywhere else?


  • Closed Accounts Posts: 522 ✭✭✭comer_97


    it does use a global.asa and it does pull information from the database.

    The Session is not abandoned anywhere on the pages and even if it was how are the values appearing, dissappearing and reappearing. It's very very strange?

    any ideas?


  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    Check your browser settings and / or firewall. The former could be set to not accept cookies from trusted sites or the latter could be stripping them out. Either way without a cookie to identify your session on your PC, it'll fail.

    Another, less likely, option is are you setting the session in one (sub-)domain and then accessing it in another? If so that will also fail.


  • Closed Accounts Posts: 522 ✭✭✭comer_97


    Thanks Corinthian,

    i check the sub domain thing, i even checked if some links were full and some were relative but they are all relative, (it could be the https, i will check).

    It's not stopping cookies because the session id always appears but when i click the link to the next page, the session info appears but it is a different session ID and the time is in a different format, but if i refresh the correct sessionid appears.


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 21,263 ✭✭✭✭Eoin


    It's a long shot - but by any chance but are you browsing to a machine with an underscore in the name? e.g. http://w2k_machinename

    I don't know if it would make a difference, but is the folder set up as an application in IIS (I would imagine if it is you are using the global.asa).


  • Closed Accounts Posts: 522 ✭✭✭comer_97


    it's an application alright and it has no underscores in the name.


  • Closed Accounts Posts: 18 hurlerman


    Are sessions and cookies enabled on the live server ?


  • Closed Accounts Posts: 522 ✭✭✭comer_97


    yes, they appear fine, then F5 and they dissapear and another session id appears, F5 again and they are back and the session ID is back again.


  • Closed Accounts Posts: 522 ✭✭✭comer_97


    my test server was iis5 and the live server is iis6, could it have something to do with this?

    Could it be that it is going to the wrong version of w3wp.exe and how would i stop it doing this?


  • Advertisement
  • Moderators, Politics Moderators Posts: 41,235 Mod ✭✭✭✭Seth Brundle


    Can you post up all code referencing your session object in the two pages?
    Do other session variables get lost also? (username, etc.)
    You said that you return to page 1 and the session number is different - how did you return to page one? Could it be coming from a cache?
    edit: this wouldn't affect a the refresh problem from this mornings post


  • Closed Accounts Posts: 522 ✭✭✭comer_97


    i have a simplified version where it is occurring, but all the session info is being lost, not just the id, everything is.

    page 1
    <%
    Session("Myvar")="Hello World"
    %>
    
    welcome to test page one</br><%=Session("MyVar")%></br>
    <a href="TestPageTwo.asp">proceed</a>
    

    page 2
    <%
    Response.write(Session.SessionID) & "<br/>"
    Response.write(NOW) & "<br/>"
    
    If Session("MyVar")<>"Hello World" Then
    
    
    Response.Write("Session='")
    Response.Write(Session("MyVar"))
    Response.Write("'</br>")
    	Response.Write("ERROR!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
    	response.end
    end if
    %>
    welcome to test page TWO</br><%=Session("MyVar")%></br>
    <a href="TestPageThree.asp">proceed</a>
    

    page 3
    <%If Session("MyVar")<>"Hello World" Then
    Response.Write("Session='")
    Response.Write(Session("MyVar"))
    Response.Write("'</br>")
    	Response.Write("ERROR!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
    	response.end
    end if
    %>
    
    welcome to test page THREE</br><%=Session("MyVar")%></br>
    <a href="TestPageTwo.asp">proceed</a>
    


  • Moderators, Politics Moderators Posts: 41,235 Mod ✭✭✭✭Seth Brundle


    Does this occur on different computers?
    Are you using frames?


  • Closed Accounts Posts: 522 ✭✭✭comer_97


    not using frames and it happens on different machines, including the server itself using localhost.


  • Moderators, Politics Moderators Posts: 41,235 Mod ✭✭✭✭Seth Brundle


    try sticking the following into each page:
    Response.Expires = 60
    Response.Expiresabsolute = Now() - 1
    Response.AddHeader "pragma","no-cache"
    Response.AddHeader "cache-control","private"
    Response.CacheControl = "no-cache"
    

    Check to see if anything on the link below applies:
    http://classicasp.aspfaq.com/general/why-won-t-my-session-variables-stick.html

    also just stick this into each page to see what is being carried across:
    <%
    For each Item in Session.Contents
         Response.Write(Item & ": " &  Session.Contents(item)  & "<br />")
    next
    %>
    


  • Closed Accounts Posts: 522 ✭✭✭comer_97


    I hade the no-cache stuff in, i think i found the problem, it seems that iis was picking up the wrong application pool because the iis was set to a webgarden. i changed it to only allow one application pool and it is working so far...

    thanks for the help, really appreciate it.


  • Moderators, Politics Moderators Posts: 41,235 Mod ✭✭✭✭Seth Brundle


    just send on the money! :D


Advertisement