怎么用AJAX做页面的浏览历史记录?(也可能不论什么 方法只要能做到实现浏览历史记录就行了)
就是用户在页面上点了一个商品;就记录一个商品
问题补充:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (Request.QueryString["lineInfoId"] == "" || Request.QueryString["lineInfoId"] == null)
{
Response.Redirect("TravelAround.aspx");
}
else
{
lineInfoid = Request.QueryString["lineInfoId"];
Response.Cookies.Add(new HttpCookie("bindShow",Request.QueryString["lineInfoId"]));
}
}
if (Request.Cookies["bindShow"].Value != "")
{
lineIdCount = lineIdCount + "," + Request.Cookies["bindShow"].Value;
HistoryRestore(lineIdCount);
}
}
private void HistoryRestore(string showID)
{
Response.Cookies.Add(new HttpCookie("lineID", showID));
if (Request.Cookies["lineID"] != null)
{
string tempStr = Request.Cookies["lineID"].Value;
string shwid = string.Empty;
string[] str = tempStr.Split(',');
for (int i = 1; i <= str.Length; i++)
{
if (i >= str.Length - 1)
{
if (shwid == "")
{
shwid = str[i - 1];
}
else
{
shwid += "," + str[i - 1];
}
}
}
string sqlSelct = "select LineTitle,HistoryImage,LinePrice,AllRoute From LineInfo where LineInfoId in(" + shwid + ")";
rpthistory.DataSource = DbSqlHelper.ExecuteDataSet(sqlSelct).Tables[0];
rpthistory.DataBind();
}
}
这是我现在写的代码,可是它把别个点击的商品也显示我的电脑上面了