tracking independant hits to page

Discussion in 'ASP .Net' started by tshad, Jul 19, 2006.

  1. tshad

    tshad Guest

    I have a page that I need to tell how many INDEPENDANT hits have occurred.

    I have the following code:

    Sub Page_Load(sender as Object, e as EventArgs)
    if not IsPostBack then
    Call InsertAuditRecord()
    end if
    End Sub

    Which just writes out to a table on who hit this page for a particular
    record.

    This works fine, but if you do a refresh, it gets counted as another hit
    since it isn't a postback. Also, the user can go to another page and then
    come back to this page and it is another hit.

    Is there a clean way to handle this so that only one hit to the page/record
    is recorded once for each visitor?

    This is for users that haven't logged on yet, so I don't have any logon
    credentials yet.

    I was thinking of putting a cookie on their machine to track it, but don't
    know if that is the best way.

    Thanks,

    Tom.
     
    tshad, Jul 19, 2006
    #1
    1. Advertising

  2. Yes, I would think that cookies would be a good informal way of doing this.
    It's not 100% bullet proof since people could delete their cookies, but you
    may not need it to be 100% bullet proof.

    --
    I hope this helps,
    Steve C. Orr, MCSD, MVP
    http://SteveOrr.net


    "tshad" <> wrote in message
    news:O%...
    >I have a page that I need to tell how many INDEPENDANT hits have occurred.
    >
    > I have the following code:
    >
    > Sub Page_Load(sender as Object, e as EventArgs)
    > if not IsPostBack then
    > Call InsertAuditRecord()
    > end if
    > End Sub
    >
    > Which just writes out to a table on who hit this page for a particular
    > record.
    >
    > This works fine, but if you do a refresh, it gets counted as another hit
    > since it isn't a postback. Also, the user can go to another page and then
    > come back to this page and it is another hit.
    >
    > Is there a clean way to handle this so that only one hit to the
    > page/record is recorded once for each visitor?
    >
    > This is for users that haven't logged on yet, so I don't have any logon
    > credentials yet.
    >
    > I was thinking of putting a cookie on their machine to track it, but don't
    > know if that is the best way.
    >
    > Thanks,
    >
    > Tom.
    >
    >
     
    Steve C. Orr [MVP, MCSD], Jul 19, 2006
    #2
    1. Advertising

  3. tshad

    tshad Guest

    "Steve C. Orr [MVP, MCSD]" <> wrote in message
    news:...
    > Yes, I would think that cookies would be a good informal way of doing
    > this.
    > It's not 100% bullet proof since people could delete their cookies, but
    > you may not need it to be 100% bullet proof.


    That was what I figured. Probably the best I can do.

    Thanks,

    Tom
    >
    > --
    > I hope this helps,
    > Steve C. Orr, MCSD, MVP
    > http://SteveOrr.net
    >
    >
    > "tshad" <> wrote in message
    > news:O%...
    >>I have a page that I need to tell how many INDEPENDANT hits have occurred.
    >>
    >> I have the following code:
    >>
    >> Sub Page_Load(sender as Object, e as EventArgs)
    >> if not IsPostBack then
    >> Call InsertAuditRecord()
    >> end if
    >> End Sub
    >>
    >> Which just writes out to a table on who hit this page for a particular
    >> record.
    >>
    >> This works fine, but if you do a refresh, it gets counted as another hit
    >> since it isn't a postback. Also, the user can go to another page and
    >> then come back to this page and it is another hit.
    >>
    >> Is there a clean way to handle this so that only one hit to the
    >> page/record is recorded once for each visitor?
    >>
    >> This is for users that haven't logged on yet, so I don't have any logon
    >> credentials yet.
    >>
    >> I was thinking of putting a cookie on their machine to track it, but
    >> don't know if that is the best way.
    >>
    >> Thanks,
    >>
    >> Tom.
    >>
    >>

    >
    >
     
    tshad, Jul 20, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mike
    Replies:
    1
    Views:
    668
    S. Justin Gengo
    Aug 8, 2003
  2. Amil
    Replies:
    2
    Views:
    395
  3. Henrik
    Replies:
    1
    Views:
    558
    Phillip Ian
    Jun 2, 2005
  4. Dos-Man
    Replies:
    5
    Views:
    1,274
    Augustus
    Mar 4, 2004
  5. goks
    Replies:
    7
    Views:
    290
    Thomas 'PointedEars' Lahn
    May 30, 2004
Loading...

Share This Page