asp.net后台老板创建的Cookie,用js获取不到 ?脑壳痛
asp.net后台创建的Cookie,用js获取不到 ?脑壳痛!Response.Cookies[SurveyInfoCTitle].Value Request[
asp.net后台创建的Cookie,用js获取不到 ?脑壳痛!
Response.Cookies["SurveyInfoCTitle"].Value = Request["SurveyTitle"];
var typesize = "";
//获取指定名字下的cookie值
var arrStr = document.cookie.split(";");
for (var m = 0; m < arrStr.length; m++) {
alert(arrStr[m]);
var temp = arrStr[m].split("=");
if (temp[0] == 'key') {
typesize = unescape(temp[1]);
}
}
alert(typesize);
alert(arrStr[m]);弹出来又有cookie,但是就是获取不到
浏览器缓存也清了。
[解决办法]逐个弹出来查看值对不对吧
alert(temp);
alert(temp[0]);
alert(temp[1]);
用脚本调试看一下
[解决办法]后台先Response.Cookies["SurveyInfoCTitle"].Value="测试";试试