静态页面点击率——差最后一步了
静态页面已经生成,并且直接将这个页面的id写进JS里,这是生成静态页面后的html代码:
浏览次数:<script language=javascript src="../../Review.aspx?id=67"></script>
protected void Page_Load(object sender, EventArgs e) { string Hits; int wyxID = int.Parse(Request.QueryString["id"].ToString()); string strConn = ConfigurationManager.ConnectionStrings["SperConnectionString1"].ToString(); SqlConnection ConnSql = new SqlConnection(strConn); ConnSql.Open(); string strSQL = "SELECT * FROM wyx_text WHERE wyx_id=" + wyxID; SqlCommand cmd = new SqlCommand(strSQL, ConnSql); SqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { Hits += dr["wyx_hits"].ToString(); } dr.Close(); Response.Write("document.write('" + Hits + "');"); }protected void Page_Load(object sender, EventArgs e)
{
string Hits="";
int wyxID = int.Parse(Request.QueryString["id"].ToString());
string strConn = ConfigurationManager.ConnectionStrings["SperConnectionString1"].ToString();
SqlConnection ConnSql = new SqlConnection(strConn);
ConnSql.Open();
string strSQL = "SELECT * FROM wyx_text WHERE wyx_id=" + wyxID;
SqlCommand cmd = new SqlCommand(strSQL, ConnSql);
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
Hits += dr["wyx_hits"].ToString();
}
dr.Close();
Response.Write("document.write('" + Hits + "');");
}