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
  1. Home
  2. Web Development
  3. ASP.NET
  4. Does Session.SessionID change on every postback for the same user?

Does Session.SessionID change on every postback for the same user?

Scheduled Pinned Locked Moved ASP.NET
question
4 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.
  • P Offline
    P Offline
    pzn3xq
    wrote on last edited by
    #1

    Hello, In my pageInit I have mSesID=Session.SessionID.ToString(); Each time a postback occurs, I receive a new sessionID #. Is this correct? Shouldn't the session be the same session value even during postbacks for the same user? I assumed it would always be the same value, but I'm probably wrong. Thanks

    T Y A 3 Replies Last reply
    0
    • P pzn3xq

      Hello, In my pageInit I have mSesID=Session.SessionID.ToString(); Each time a postback occurs, I receive a new sessionID #. Is this correct? Shouldn't the session be the same session value even during postbacks for the same user? I assumed it would always be the same value, but I'm probably wrong. Thanks

      T Offline
      T Offline
      ToddHileHoffer
      wrote on last edited by
      #2

      I'm not sure but you could easily create a new guid and store that in session. Then you would have an identifier.

      I didn't get any requirements for the signature

      1 Reply Last reply
      0
      • P pzn3xq

        Hello, In my pageInit I have mSesID=Session.SessionID.ToString(); Each time a postback occurs, I receive a new sessionID #. Is this correct? Shouldn't the session be the same session value even during postbacks for the same user? I assumed it would always be the same value, but I'm probably wrong. Thanks

        Y Offline
        Y Offline
        Yusuf
        wrote on last edited by
        #3

        According to MSDN it should be unique for the session. See Here[^]

        Yusuf Can I help you?

        1 Reply Last reply
        0
        • P pzn3xq

          Hello, In my pageInit I have mSesID=Session.SessionID.ToString(); Each time a postback occurs, I receive a new sessionID #. Is this correct? Shouldn't the session be the same session value even during postbacks for the same user? I assumed it would always be the same value, but I'm probably wrong. Thanks

          A Offline
          A Offline
          AlexeiXX3
          wrote on last edited by
          #4

          You will receive different sessionID while you havent save something in the session Once you save something in the session, the sessionID will remain the same

          Protected Sub Page\_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
              Response.Write("Init " & Session.SessionID)
          End Sub
          
          Protected Sub Page\_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
              If Not Page.IsPostBack Then Session("X") = "X"
          End Sub
          

          Alexei Rodriguez

          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