First, create a text file, name it as txtcounter.txt, and place it in the root folder or your application.
The GetStat() function will return the latest updated from the text file, and write new stat to it:
protected string GetStat()
{
strFile = Server.MapPath("txtcounter.txt");
sr = File.OpenText(strFile);
counter = sr.ReadToEnd();
sr.Close();
i = int.Parse(counter) +1;
counter=i.ToString();
sw = File.CreateText(strFile);
sw.Write(counter);
sw.Close();
return counter;
}
Call this functin from the Form Load subroutine:
protected void Page_Load(object sender, EventArgs e)
{
lbl.Text = GetStat();
}
Happy Coding!





