Could anyone helps me by giving the answer for my question.
Here is the question…
How can we count the number of hits on our website for the day using c#
Thanks,
Bharath
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Just create a counter and a persistence way to keep the values. This can be a File or Database.
The code below is for learning proposes, you should use an existing service for this as it’s much more efficiency and you will not have lock problems if to many hits happen in the same time
create a new Class for example:
in Code:
when you want to see how many hits, you can use
If you have a lot of pages and don’t want to do this on each one, and assuming your project is WebForms, you can create a MasterPage and append this
Add()to the MasterPageOnLoadevent or you can create your own page and implement the code.As an option to your real problem, you can use Woopra service for live results, I use in some forums and it’s quite lovely see all users, you just need to create an account and use their javascript code in all your footer (normally we use a master page and just append in one file)