詳細內(nèi)容
jimdo網(wǎng)站訪問量統(tǒng)計代碼
在jimdo建了個站里面沒有訪問量統(tǒng)計,請問是不是可以在模塊輸入代碼來統(tǒng)計訪問量的?代碼是多少麻煩寫下來。請不要叫我去其他地方建站或到網(wǎng)上搜!
C#代碼
//HttpCookie CkeCount = new HttpCookie("Count");
//DataSet objDataSet = new DataSet();
//if (Request.Cookies["Count"] == null)
{
CkeCount.Value = "true";
objDataSet.ReadXml(Server.MapPath("count.xml")); //dataset讀xml文件
objDataSet.Tables["MyCount"].Rows[0]["AllCount"] = Convert.ToInt32(objDataSet.Tables["MyCount"].Rows[0]["AllCount"]) + 1;//這里是寫如xml,更新第一行Allcount標簽的值
objDataSet.WriteXml(Server.MapPath("count.xml"));//寫如xml Response.Cookies.Add(CkeCount);//寫入cookies
}
lbCount.Text = "網(wǎng)站訪問總量:" + objDataSet.Tables["MyCount"].Rows[0]["AllCount"].ToString();//顯示在頁面上
count.xml
<MyCount>
<AllCount>36</AllCount>
<MaxCount>0</MaxCount>
</MyCount>