//代码
protected void GetArticleList()
{
ArticleInfoBLL objArticleInfo = new ArticleInfoBLL();
HttpCookie MyCookie = new HttpCookie("UserID", Request.QueryString["Id"]);
Response.Cookies.Add(MyCookie);
int i = int.Parse(Request.Cookies["UserID"].Value);
rpt_Articlelist.DataSource = objArticleInfo.GetArticleList(i);
rpt_Articlelist.DataBind();
}
//截图
//截图
看不到图
发个设置Cookies 和 获取Cookies的函数给你,直接调用就可以了
public static void SetCookie(string p_strKey, string p_strValue)
{
HttpCookie MyCookies = new HttpCookie(p_strKey);
HttpContext.Current.Response.Cookies.Remove(p_strKey);
MyCookies.Value = HttpContext.Current.Server.UrlEncode(p_strValue);
HttpContext.Current.Response.Cookies.Add(MyCookies);
}
public static string GetCookie(string p_strKey)
{
if (System.Web.HttpContext.Current.Request.Cookies[p_strKey] == null)
return "";
return HttpContext.Current.Server.UrlDecode(System.Web.HttpContext.Current.Request.Cookies[p_strKey].Value);
}