Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. Doubt about 'Session'

Doubt about 'Session'

Scheduled Pinned Locked Moved ASP.NET
questionsysadmin
8 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    tina newcoder
    wrote on last edited by
    #1

    When a client is connected with the server, a session is assigned with that client uniquely, now a sessionID is stored as cookie on the client's system. Now, i m trying to check the value of this ID, as Session.SessionID but, each time the page is re-loaded, the ID changes .... ! Why does the ID change ? Is there anything wrong in my code, or the ID actually changes when the page is re-loaded ???

    P C T S 4 Replies Last reply
    0
    • T tina newcoder

      When a client is connected with the server, a session is assigned with that client uniquely, now a sessionID is stored as cookie on the client's system. Now, i m trying to check the value of this ID, as Session.SessionID but, each time the page is re-loaded, the ID changes .... ! Why does the ID change ? Is there anything wrong in my code, or the ID actually changes when the page is re-loaded ???

      P Offline
      P Offline
      paresh_sarjani
      wrote on last edited by
      #2

      i thinkkk sesssiion closes after u reload and new session is created check out ur code properly

      T 1 Reply Last reply
      0
      • T tina newcoder

        When a client is connected with the server, a session is assigned with that client uniquely, now a sessionID is stored as cookie on the client's system. Now, i m trying to check the value of this ID, as Session.SessionID but, each time the page is re-loaded, the ID changes .... ! Why does the ID change ? Is there anything wrong in my code, or the ID actually changes when the page is re-loaded ???

        C Offline
        C Offline
        Christian Graus
        wrote on last edited by
        #3

        You're storing a cookie ? I don't believe the session does this by default. One good thing about the Session is that, unlike cookies, the user cannot turn it off.

        Christian Graus Please read this if you don't understand the answer I've given you. If you're still stuck, ask me for more information.

        T 1 Reply Last reply
        0
        • P paresh_sarjani

          i thinkkk sesssiion closes after u reload and new session is created check out ur code properly

          T Offline
          T Offline
          tina newcoder
          wrote on last edited by
          #4

          my code,

          protected void Page_Load(object sender, EventArgs e)
          {
          System.Windows.Forms.MessageBox.Show(Session.SessionID.ToString());
          }

          The above code shows a message box with the current Session ID.

          1 Reply Last reply
          0
          • C Christian Graus

            You're storing a cookie ? I don't believe the session does this by default. One good thing about the Session is that, unlike cookies, the user cannot turn it off.

            Christian Graus Please read this if you don't understand the answer I've given you. If you're still stuck, ask me for more information.

            T Offline
            T Offline
            tina newcoder
            wrote on last edited by
            #5

            na ... i am not storing any cookie ...!

            1 Reply Last reply
            0
            • T tina newcoder

              When a client is connected with the server, a session is assigned with that client uniquely, now a sessionID is stored as cookie on the client's system. Now, i m trying to check the value of this ID, as Session.SessionID but, each time the page is re-loaded, the ID changes .... ! Why does the ID change ? Is there anything wrong in my code, or the ID actually changes when the page is re-loaded ???

              T Offline
              T Offline
              tina newcoder
              wrote on last edited by
              #6

              I have tested that (posted) code for both IE 6.0 and Firefox 2.0 Both are showing similar behavior !!!! :confused: :confused: :confused: :confused: :confused: :confused: :confused:

              1 Reply Last reply
              0
              • T tina newcoder

                When a client is connected with the server, a session is assigned with that client uniquely, now a sessionID is stored as cookie on the client's system. Now, i m trying to check the value of this ID, as Session.SessionID but, each time the page is re-loaded, the ID changes .... ! Why does the ID change ? Is there anything wrong in my code, or the ID actually changes when the page is re-loaded ???

                S Offline
                S Offline
                Steve Westbrook
                wrote on last edited by
                #7

                Try to replicate this issue in an empty web app. If it occurs, then the problem is with your server's configuration (machine.config). If not, the problem is only application-level. My guess is that this is the case: see if you have a really low session Timeout set, or if you have a Session.Abandon() command somewhere in your program.

                T 1 Reply Last reply
                0
                • S Steve Westbrook

                  Try to replicate this issue in an empty web app. If it occurs, then the problem is with your server's configuration (machine.config). If not, the problem is only application-level. My guess is that this is the case: see if you have a really low session Timeout set, or if you have a Session.Abandon() command somewhere in your program.

                  T Offline
                  T Offline
                  tina newcoder
                  wrote on last edited by
                  #8

                  Steve Westbrook wrote:

                  Try to replicate this issue in an empty web app

                  the code i shwon is of an empty web-app.

                  Steve Westbrook wrote:

                  server's configuration (machine.config)

                  how to fix it ?

                  Steve Westbrook wrote:

                  low session Timeout set,

                  i m not changing, so the default 20min shall be there...

                  Steve Westbrook wrote:

                  Session.Abandon()

                  na .. it is not the case. What is the result of 'that' code on your machine ? :confused:

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups