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. Session ID

Session ID

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netquestionworkspace
2 Posts 2 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.
  • G Offline
    G Offline
    Gary Hyslop at home
    wrote on last edited by
    #1

    In ASP.NET I am identifying sessions by incrementing a counter in a global class, which is initialized to 0. The Page Load code increments the counter inside a !IsPostBack conditional. There is Response.Write at the end of the conditional block that displays the counter on the page. Most of the time it works fine and each session has its unique ID. Under some circumstances "0" is displayed when the page is first accessed. There is only one link that is used to request the page. This is a controlled test environment. Can anyone conjecture on how the IsPostBack event can fire upon the initial page request? The code: private void Page_Load ... { if (!IsPostBack) { ++Global.session_id; ... } Response.Write("Global.session_id.ToString()); | Gary Hyslop

    S 1 Reply Last reply
    0
    • G Gary Hyslop at home

      In ASP.NET I am identifying sessions by incrementing a counter in a global class, which is initialized to 0. The Page Load code increments the counter inside a !IsPostBack conditional. There is Response.Write at the end of the conditional block that displays the counter on the page. Most of the time it works fine and each session has its unique ID. Under some circumstances "0" is displayed when the page is first accessed. There is only one link that is used to request the page. This is a controlled test environment. Can anyone conjecture on how the IsPostBack event can fire upon the initial page request? The code: private void Page_Load ... { if (!IsPostBack) { ++Global.session_id; ... } Response.Write("Global.session_id.ToString()); | Gary Hyslop

      S Offline
      S Offline
      Steven Campbell
      wrote on last edited by
      #2

      Why not just use Session.SessionId, i.e. the normal session id provided by ASP.NET?


      my blog

      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