电脑桌面
添加小米粒文库到电脑桌面
安装后可以在桌面快捷访问

C#实现访客浏览历史记录的方法

C#实现访客浏览历史记录的方法_第1页
1/1
下载后可任意编辑C#实现访客浏览历史记录(足迹)的方法:cookiestringcookie 记录用户浏览的 ID,格式为-1-2-3-4-5-。#region 存储 cookie set(key,value,days)public static bool set( string strName, string strValue, int strDay ){try{HttpCookie Cookie = new HttpCookie( strName );Cookie.Domain = GetHost(); /* 当 要 跨 域 名 访 问 的 时 候 , 给cookie指定域名即可,xxxx */Cookie.Expires = DateTime.Now.AddDays( strDay );Cookie.Value = strValue;HttpContext.Current.Response.Cookies.Add( Cookie );return(true);}catch{return(false);}}#endregion#region 读取cookie值 get(key)public static string get( string strName ){HttpCookie Cookie = HttpContext.Current.Request.Cookies[strName];if ( Cookie != null ){return(Cookie.Value.ToString() );}else {return(null);}}#endregion#region 用 户 历 史 记 录 public static void history( string id ){varisHit= false;varhistory = Cookie.get( “history” );if ( string.IsNullOrEmpty( history ) ){CookieHelper.Cookie.set( “history”, “-” + id + “-”, 1 );isHit = true;}else {/* -1-2-3-4-5-6-7- */if ( history.Contains( “-” + id + “-” ) ){history = history.Replace( “-” + id, ““ );history = “-” + id + history;}else {history = “-” + id + history;isHit= true;}Cookie.set( “history”, history );}if ( isHit ){/* 用户浏览写入数据库 */}}#endregion1

1、当您付费下载文档后,您只拥有了使用权限,并不意味着购买了版权,文档只能用于自身使用,不得用于其他商业用途(如 [转卖]进行直接盈利或[编辑后售卖]进行间接盈利)。
2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。
3、如文档内容存在违规,或者侵犯商业秘密、侵犯著作权等,请点击“违规举报”。

碎片内容

C#实现访客浏览历史记录的方法

确认删除?
VIP
微信客服
  • 扫码咨询
会员Q群
  • 会员专属群点击这里加入QQ群
客服邮箱
回到顶部