开发者

Determine the view count for specific page in Asp.net MVC

开发者 https://www.devze.com 2022-12-20 22:21 出处:网络
Do anyone know开发者_运维技巧s how to do the View count for a specific page. Like in StackOverflow, in the question list you would see the View count which describes how many times the question was vi

Do anyone know开发者_运维技巧s how to do the View count for a specific page. Like in StackOverflow, in the question list you would see the View count which describes how many times the question was viewed.

I would like to know how to do this in asp.net mvc. I already have an idea but im not sure if right.

I need an expert advice... thanks


A common way to do this is to log the number of times a page is requested in a database. You can then add a property to your domain object which can be populated in the normal manner by your data access layer, e.g.

public class Question
{
    public int HitCount { get; set; }
}

You can then display this in your page.


Google Analytics is a VERY good tool, when used properly.

0

精彩评论

暂无评论...
验证码 换一张
取 消