Go to Global.asax page and add the following code
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 open your aspx page and write the following code
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1"runat="server">
<table>
<tr>
<td>
<b>No of Visits:</b>
</td>
<td>
<asp:Label ID="lblCount" runat="server" ForeColor="Red" />
</td>
</tr>
</table>
</form>
</body>
</html>
Now open your cs file and add the following code
protected void Page_Load(object sender, EventArgs e)
{
lblCount.Text = Application["NoOfVisitors"].ToString();
}
Refer
http://www.aspdotnet-suresh.com/2013/11/asp-net-count-number-of-visitors-in-Website.html[
^]