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. How to Find Website Visitor No

How to Find Website Visitor No

Scheduled Pinned Locked Moved ASP.NET
tutorial
7 Posts 5 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.
  • S Offline
    S Offline
    Samarjeet Singh india
    wrote on last edited by
    #1

    Hi To, I Want to count visitor no of our site and also display it in my site by which user can see his visitor no of site. for which I have written this code in globle asax in application start event and show it in the master page. but the value is reset every time. The code is .. Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs) Application("visitor") = 1 End Sub and the code of session_start is.. Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs) Application("visitor") = CType(Application("visitor"), Integer) + 1 End Sub and display it in the form load int master page Me.Label1.Text = "Visitor No " + Application("visitor").ToString()

    C T A P 4 Replies Last reply
    0
    • S Samarjeet Singh india

      Hi To, I Want to count visitor no of our site and also display it in my site by which user can see his visitor no of site. for which I have written this code in globle asax in application start event and show it in the master page. but the value is reset every time. The code is .. Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs) Application("visitor") = 1 End Sub and the code of session_start is.. Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs) Application("visitor") = CType(Application("visitor"), Integer) + 1 End Sub and display it in the form load int master page Me.Label1.Text = "Visitor No " + Application("visitor").ToString()

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

      Samarjeet Singh@india wrote:

      Me.Label1.Text = "Visitor No " + Application("visitor").ToString()

      Of course you don't call it Label1, right ? Of course it's reset. EVery time the application is. You need to persist it somewhere for it to never reset, like a text file or a DB.

      Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

      S 1 Reply Last reply
      0
      • S Samarjeet Singh india

        Hi To, I Want to count visitor no of our site and also display it in my site by which user can see his visitor no of site. for which I have written this code in globle asax in application start event and show it in the master page. but the value is reset every time. The code is .. Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs) Application("visitor") = 1 End Sub and the code of session_start is.. Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs) Application("visitor") = CType(Application("visitor"), Integer) + 1 End Sub and display it in the form load int master page Me.Label1.Text = "Visitor No " + Application("visitor").ToString()

        T Offline
        T Offline
        Tamer Oz
        wrote on last edited by
        #3

        This code is for current visitors on site if you implement Session_end event too. If you are trying to count total visitors you must use a database or any kind of data storage

        1 Reply Last reply
        0
        • C Christian Graus

          Samarjeet Singh@india wrote:

          Me.Label1.Text = "Visitor No " + Application("visitor").ToString()

          Of course you don't call it Label1, right ? Of course it's reset. EVery time the application is. You need to persist it somewhere for it to never reset, like a text file or a DB.

          Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

          S Offline
          S Offline
          Samarjeet Singh india
          wrote on last edited by
          #4

          Thnks for Reply... Yes it may be value reset but I am taking application type variable then why it is reset from 100 to 1. just give me some hints. is there any way inwhich we can show it with out store db or file....

          C 1 Reply Last reply
          0
          • S Samarjeet Singh india

            Thnks for Reply... Yes it may be value reset but I am taking application type variable then why it is reset from 100 to 1. just give me some hints. is there any way inwhich we can show it with out store db or file....

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

            Samarjeet Singh@india wrote:

            just give me some hints. is there any way inwhich we can show it with out store db or file....

            Well, that's what I just told you to do, didn't I ? Which bit are you stuck on ? If you've written a website that is likely to care about a visit count, surely you know how to use a database, or a flat file ?

            Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

            1 Reply Last reply
            0
            • S Samarjeet Singh india

              Hi To, I Want to count visitor no of our site and also display it in my site by which user can see his visitor no of site. for which I have written this code in globle asax in application start event and show it in the master page. but the value is reset every time. The code is .. Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs) Application("visitor") = 1 End Sub and the code of session_start is.. Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs) Application("visitor") = CType(Application("visitor"), Integer) + 1 End Sub and display it in the form load int master page Me.Label1.Text = "Visitor No " + Application("visitor").ToString()

              A Offline
              A Offline
              Arun Jacob
              wrote on last edited by
              #6

              As Christian said, on application start get that text file/DB to display total number of visitors and on session start get that value,add 1 and save back. :)

              Arun Jacob http://codepronet.blogspot.com/

              1 Reply Last reply
              0
              • S Samarjeet Singh india

                Hi To, I Want to count visitor no of our site and also display it in my site by which user can see his visitor no of site. for which I have written this code in globle asax in application start event and show it in the master page. but the value is reset every time. The code is .. Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs) Application("visitor") = 1 End Sub and the code of session_start is.. Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs) Application("visitor") = CType(Application("visitor"), Integer) + 1 End Sub and display it in the form load int master page Me.Label1.Text = "Visitor No " + Application("visitor").ToString()

                P Offline
                P Offline
                Prabhakar Parihar
                wrote on last edited by
                #7

                it's very easy process you may go now this url http://www.amazingcounters.com And Chose Your Visitor Counter Designed & Copy the code or Add ur Site master page...................

                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