Friday, May 27, 2011

Count Every Visitor on page through the use of Xml

    Create Xml File—Counter.Xml
  • &lt?xml version="1.0" standalone="yes"?&gt

  • &ltcounter&gt

  • &ltcount&gt

  • &lthits&gt0&lthits&gt

  • &ltcount&gt

  • &ltcounter&gt



On page load




this.countMe();

DataSet ds = new DataSet();

ds.ReadXml(Server.MapPath("counter.xml"));

lblcounter.Text = ds.Tables[0].Rows[0]["hits"].ToString().Trim();


Lblcounter is the id of the label which is defined in the .aspx Page.



&ltasp:Label ID="lblcounter" runat="server" Text="Label" BackColor="#CCFF99"
ondatabinding="Page_Load" BorderColor="Maroon"&gt&lt/asp:Label&gt

No comments:

Post a Comment