您好,登录后才能下订单哦!
//通过Cookie记录游客IP5分钟内,浏览次数不会增加
protected void Page_Init(object sender, EventArgs e)
{
//记录游客的IP及cookie
string userIp =Page.Request.UserHostAddress.ToString();
if (Request.Cookies["userIp"] == null)
{
HttpCookie cookieIp = new HttpCookie("userIp");
DateTime dtNow = DateTime.Now;
TimeSpan tsTime = new TimeSpan(0, 0, 300);//cookie的存活期是60秒
cookieIp.Expires = dtNow + tsTime;
Response.Cookies.Add(cookieIp);
//浏览次数+1(更新)
int supplyID = int.Parse(Request.QueryString["SupplyID"].ToString());
string updateHits = "update SupplyInfo set Hits=Hits+1 where SupplyID=" + supplyID;
DataAccess.DC.ExecSqlReturn(updateHits);
}
}
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。