ASP.NET和C#页查看计数器:使用数据库 [英] ASP.NET and C# Page View Counter: Using a Database

查看:128
本文介绍了ASP.NET和C#页查看计数器:使用数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一个上类似于stackoverflow.com

I'm a working on a project similar to the concept of stackoverflow.com

将有很多的问题,我想有一个页面视图计数器的每一个问题。

There will be lots of questions, and I would like to have a Page View Counter for every question.

我觉得最好的方法是使用一个数据库,因为问题的数量将是很大的,它会按时间而增加。

I feel that the best way is to use a database, since the number of questions will be big, and it will increase by time.

如果我刚刚创建了一个TABLE Question_Views
和对每一个问题的行这将是很容易的。

It would be really easy if I just created a TABLE Question_Views And have a row for each question.

这样的事情。

ID-----Question_ID------Views
1-------23--------------400
2-------24--------------301
3-------25--------------123

但是否页柜台取考虑的IP地址?意味着,如果我打开的问题23号的网页,然后改天我会针对这一问题,以及,它增加1,或2?

But does page counters take in consideration the IP Address? means, if I open the webpage of question number 23, and then another day I'll view this question as well, does it increment 1, or 2?

如果我需要考虑的IP地址,这种做法是一种错误权

And if I need to take in consideration the IP Address, this approach is kind of wrong right?

推荐答案

它听起来很简单 - 但它不是如果你喜欢一个准确的计数器。结果
你有

Its sounds easy - but its not if you like an accurate counter.
You have


  • 搜索引擎读取和索引你的网页,都知道和未知

  • 有残疾的cookies的用户,和/或禁用了JavaScript

  • 谷歌和Bing,从您的网站活页上一页
  • $捕捉图像b $ b
  • 用户再次证明负荷,再次刷新

  • 页面
  • 是企业防火墙后面,有共同的IPS。

  • 用户用户这种变化IPS,因为他们是使用动态IP连接

  • 攻击者试图操纵数据。

  • Bots that reads and index your page, both know and unknown
  • Users with disabled cookies, and/or disabled javascript
  • Google and Bing that capture the image from your site for live previou
  • Users that load again and again the page for refresh
  • Users that are behind corporate firewall and have common ips.
  • Users that change ips because they are use dynamic ip connection
  • Attackers that try to manipulate the data.

就在这个天YouTube上删除了数十亿从页面访问量的统计造假的数据!

Just this days YouTube remove billions of false statistics data from the page views!

所以现在的问题是,你打算什么来衡量?

So the question is now, what are you going to measure ?


  1. 访问?

  2. 的访客?

  3. 页面访问量?

  4. 独特页面访问量?

  1. Visits ?
  2. Visitors ?
  3. Page Views ?
  4. Unique Page Views ?

点击,造访,访客,浏览量和唯一浏览量都在你打算如何衡量的意见至关重要的区别

The difference between clicks, visits, visitors, pageviews, and unique pageviews are critical on how you going to measure the views.

也就是你如何识别这是一个游客,而不是一个机器人,或者攻击者试图操纵柜台关键?

Also is critical on how you recognize that is a visitor and not a bot, or an attacker that try to manipulate the counter ?

一个想法是记录所有的参数,并显示在页面的独特看法。一个用户可以算作1独特的页面浏览,即便是看网页10次有cookie的会话。当会话过期,用户再来,例如,如果他来了之后60分钟与出会话,然后你再指望他了。

One idea is to keep track of all that parameters, and show the unique page views. One user can count as 1 unique page view, even if is see the page 10 times for the session of cookie that have. When the session expires and the user come again, eg if he come after 60 minute with out session, then you count him again.

和这里的困难是找到所有该机器人,与假用户即看到一个页面去。

And the difficult here is to locate all the bots, and the "false users" that see one page and go.

这篇关于ASP.NET和C#页查看计数器:使用数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆