Public · Protected · Private
ASP.NET : Display the number of visits on a page
Type: Public  |  Created: 2012-07-05  |  Frozen: Yes
« Previous Public Blog Next Public Blog »
Comments
  • public partial class _Default : System.Web.UI.Page { static int counter = 0; private static readonly Object lockObj = new Object (); protected void Page_Load(object sender, EventArgs e) { ++counter; lock (lockObj) { Application["SiteCounter"] = counter; } Response.Write("This page is visited "+ counter.ToString() + " times"); Response.Write("since restart of IIS or this webapplication"); } }
    2012-07-05 20:36
This blog is frozen. No new comments or edits allowed.