Unable to list session data

 
Post new topic   Reply to topic    Aprelium Forum Index -> Classic ASP
View previous topic :: View next topic  
Author Message
aven
-


Joined: 26 Dec 2003
Posts: 12
Location: Huddinge, Stockholm, Sweden

PostPosted: Tue Dec 30, 2003 3:10 pm    Post subject: Unable to list session data Reply with quote

First look at this example and try to guess its output.

    <%
    Session.Contents("test") = "just an example"
    %>

    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    <body>

    <%
    Session.Contents("second_test") = 5
    Response.Write "There are " & Session.Contents.Count & " variables in Session.<br>"
    Response.Write(Session("test") & "<br>")
    for each name in Session.Contents
    Response.Write name & " = " & Session(name) & "<br>"
    next
    %>

    </body>
    </html>


Now, look at the resulting output...

Quote:
There are 0 variables in Session.
just an example


Why?
I don't know if this have been the case all the time but I suddenly do have problems with saving data in the session object from one page to another. Does anyone know of this behavior before?
    Back to top View user's profile Send private message
    aven
    -


    Joined: 26 Dec 2003
    Posts: 12
    Location: Huddinge, Stockholm, Sweden

    PostPosted: Tue Dec 30, 2003 3:30 pm    Post subject: Reply with quote

    Here's another example of the same kind

      <%
      SET temp = Server.CreateObject("ADODB.Recordset")
      SET Session.Contents("test") = temp
      %>

      <html>
      <head>
      <title>Untitled Document</title>
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
      </head>
      <body>

      <%
      Response.Write("There are " & Session.StaticObjects.Count & " objects in Session.<br>")
      Response.Write(TypeName(Session("test")) & "<br>")
      for each name in Session.StaticObjects
      Response.Write(name & " : " & TypeName(Session(name)) & "<br>")
      next
      %>

      </body>
      </html>


    And this is the resulting output:

    Quote:
    There are 0 objects in Session.
    Recordset
    Back to top View user's profile Send private message
    Display posts from previous:   
    Post new topic   Reply to topic    Aprelium Forum Index -> Classic ASP All times are GMT + 1 Hour
    Page 1 of 1

     
    Jump to:  
    You cannot post new topics in this forum
    You cannot reply to topics in this forum
    You cannot edit your posts in this forum
    You cannot delete your posts in this forum
    You cannot vote in polls in this forum


    Powered by phpBB phpBB Group