后台加入Cookie
HttpCookie PicCookie = new HttpCookie("PicCookies");PicCookie.Values.Add("id_1_1","N-123456");
PicCookie.Values.Add("title_1_1", "T-123456");前台网页中读取
<%=Request.Cookies["PicCookies"].Values["title_1_1"] %>
<%=Request.Cookies["PicCookies"].Values["id_1_1"] %>一运行前台就(未将对象引用设置到对象的实例。)
HttpCookie PicCookie = new HttpCookie("PicCookies");PicCookie.Values.Add("id_1_1","N-123456");
PicCookie.Values.Add("title_1_1", "T-123456");前台网页中读取
<%=Request.Cookies["PicCookies"].Values["title_1_1"] %>
<%=Request.Cookies["PicCookies"].Values["id_1_1"] %>一运行前台就(未将对象引用设置到对象的实例。)
PicCookie.Values.Add("title_1_1", "T-123456"); Response.Cookies.Add(PicCookie);把红色部分加上,你都没添加到response,怎么可能在前台能拿到呢?
function readCookie(name)
{
var start = document.cookie.indexOf( name + "=" );
var len = start + name.length + 1;
if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) )
{
return null;
}
if ( start == -1 )
return null;
var end = document.cookie.indexOf( ';', len );
if ( end == -1 )
end = document.cookie.length;
return decodeURI(document.cookie.substring(len,end));
}