Click here to Skip to main content
15,918,211 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to get the Sharepoint Site Hits that means How many members visited my Site,
i have to develop this in VisualStudio .Net Framwork 3.5,i want to assign the totalHits to Lable

What I have tried:

protected void Page_Load(object sender, EventArgs e)
{
this.countMe();

DataSet tmpDs = new DataSet();
tmpDs.ReadXml(Server.MapPath("~/Element.xml"));

lblvisitors.Text = tmpDs.Tables[0].Rows[0]["hits"].ToString();
}

private void countMe()
{
DataSet tmpDs = new DataSet();
tmpDs.ReadXml(Server.MapPath("~/Element.xml"));

int hits = Int32.Parse(tmpDs.Tables[0].Rows[0]["hits"].ToString());

hits += 1;

tmpDs.Tables[0].Rows[0]["hits"] = hits.ToString();

tmpDs.WriteXml(Server.MapPath("~/Element.xml"));

}
Posted
Comments
Sinisa Hajnal 8-Apr-16 7:02am    
And? What is the problem? What do you get from the above code? Also, why writing integer value hits as a string to the dataset?
Member 11670914 8-Apr-16 7:16am    
Hi Sinisa,

I want to get the Number of visitors visited my site i want Count

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900