62,041
社区成员
发帖
与我相关
我的任务
分享
//设置Cookie
HttpCookie hc = new HttpCookie("UserName");
hc.Value = "姓名";
HttpContext.Current.Response.Cookies.Add(hc);
//获取Cookie
HttpContext.Current.Response.Write(HttpContext.Current.Request.Cookies["UserName"].Value);
设置
Response.Cookies["Mycookie"].Value = HttpUtility.UrlEncode("健康", Encoding.GetEncoding("GB2312"));
获取用的代码:
NameValueCollection nv = HttpUtility.ParseQueryString(Response.Cookies["Mycookie"].Value, Encoding.GetEncoding("GB2312"));
string proname = nv["ID"];
string sqlstr = "select * from btproduct where productname like'%" + proname + "%'";
帮你搜的,没有经过测试