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. Problem with hit counter increment.

Problem with hit counter increment.

Scheduled Pinned Locked Moved ASP.NET
helpdatabasequestion
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.
  • A Offline
    A Offline
    Atul Kharecha
    wrote on last edited by
    #1

    I have label on homepage showing number of hits. I have used Session to keep track of it using database. When new session starts, its increment and on home page its getting reset. The problem is it works fine when I open site in new window, but when opened in multiple tabs of IE7, it shows same users and not incrementing. Here is the code. //Assigned 1 from global.asax on starting of each new session. lock (this) { HomeDataInterface oHits = new HomeDataInterface(); if (Session["Hits"].ToString() == "1") { oHits.QACoEHits(); Session["Hits"] = "0"; } lblHits.Text = lblHits.Text + oHits.GetQACoEHits(); } I added lock(this) but that is also not working. Can anyone help please?

    A 1 Reply Last reply
    0
    • A Atul Kharecha

      I have label on homepage showing number of hits. I have used Session to keep track of it using database. When new session starts, its increment and on home page its getting reset. The problem is it works fine when I open site in new window, but when opened in multiple tabs of IE7, it shows same users and not incrementing. Here is the code. //Assigned 1 from global.asax on starting of each new session. lock (this) { HomeDataInterface oHits = new HomeDataInterface(); if (Session["Hits"].ToString() == "1") { oHits.QACoEHits(); Session["Hits"] = "0"; } lblHits.Text = lblHits.Text + oHits.GetQACoEHits(); } I added lock(this) but that is also not working. Can anyone help please?

      A Offline
      A Offline
      Abhijit Jana
      wrote on last edited by
      #2

      Have a look[^]

      cheers, Abhijit

      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