Do anyone knows 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, eg
public class Question
{
public int HitCount { get; set; }
}
You can then display this in your page.
如果使用得当, Google Analytics是一个非常好的工具。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.