Gururaj Jewargi

Gururaj Jewargi

  • NA
  • 663
  • 768.1k

Count of visitors visiting the website in asp.net Using C#

Nov 7 2016 5:58 AM
Hi Everyone,
                 Find the below code this code is not working exactly. whenever i visited website it showing count 11 after again showing count 10.
global.aspx 
protected void Application_Start(object sender, EventArgs e)
{
Application["NoVisitors"] = 10;
}
protected void Session_Start(object sender, EventArgs e)
{
Application.Lock();
Application["NoVisitors"] = (int)Application["NoVisitors"] + 1;
Application.UnLock();
}
protected void Session_End(object sender, EventArgs e)
{
}
 
index.aspx
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
lblcount.Text = Application["NoVisitors"].ToString();
}
}
 

Answers (1)