---
title: "how to count number of visitors for website"  
description: "how to count number of visitors for website"  
author: "Anonymous User"  
published: 2014-10-04  
updated: 2014-10-04  
canonical: https://www.mindstick.com/forum/2295/how-to-count-number-of-visitors-for-website  
category: "asp.net"  
tags: ["asp.net", "asp.net mvc", "c#"]  
reading_time: 1 minute  

---

# how to count number of visitors for website

how to [count](https://www.mindstick.com/forum/157774/selecting-count-with-distinct) number of visitors for [website](https://www.mindstick.com/articles/13110/why-copywriting-is-crucial-for-new-website-build) using [asp.net](https://www.mindstick.com/articles/934/default-folders-available-inside-the-asp-dot-net-application-folder) in c#

## Replies

### Reply by Anonymous User

Here I will explain how to count number of visitors to website in asp.net using c#here is Global.asax file\

```
void Application_Start(object sender, EventArgs e) {     Application["NoOfVisitors"] = 0;}void Session_Start(object sender, EventArgs e) {    Application.Lock();    Application["NoOfVisitors"] = (int)Application["NoOfVisitors"] + 1;    Application.UnLock();}now aspx page<table>            <tr>                <td>                    <b>No of Visits:</b>                </td>                <td>                    <asp:Label ID="lblCount" runat="server" ForeColor="Red" />                </td>            </tr>        </table>
```

**now aspx.cs page**

lblCount.Text = Application["NoOfVisitors"].ToString();


---

Original Source: https://www.mindstick.com/forum/2295/how-to-count-number-of-visitors-for-website

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
