HttpCookie cookie=new HttpCookie("MyCookies");
if(cookie.Values["SpecialProductType"]==null)
{
type=Request.QueryString["type"];
cookie.Values.Add("SpecialProductType",type);
Response.AppendCookie(cookie);
}
else{
type=cookie.Values["SpecialProductType"];
}if(type=="xxx"){xxxx}
/////type等那个cookie的值了,和xxx比较老没反应
怎么样转换才能让type和xxx能比较? 谢谢了
在线等 马上给分~~~~~~~~~~~~~~~~~~~~~~~~~~~!!!!!!!!!!!!!
if(cookie.Values["SpecialProductType"]==null)
{
type=Request.QueryString["type"];
cookie.Values.Add("SpecialProductType",type);
Response.AppendCookie(cookie);
}
else{
type=cookie.Values["SpecialProductType"];
}if(type=="xxx"){xxxx}
/////type等那个cookie的值了,和xxx比较老没反应
怎么样转换才能让type和xxx能比较? 谢谢了
在线等 马上给分~~~~~~~~~~~~~~~~~~~~~~~~~~~!!!!!!!!!!!!!
========================================
我的签名(2004年12月24日 15时00分03秒)
我是要取得cookie和字符串xxx做比较
Response.Cookies["MyCookies"].Expires = DateTime.Now.AddMinutes(1);
if(Request.Cookies["MyCookies"] == null)
{
证明你的浏览器接受cookie
}
else
{
证明你的浏览器不接受cooie
}
但我用它和字符串xxx做比较,就没有反应,
把它用ToString()转换就出错 说:未将对象引用设置到对象的实例
{
string str=Request.Cookies["MyCookies"].ToString();
if (str==字符串)
{
Response.Write("it's right');
}
}
结帐~~啦