如何用js读取cookie?
我在程序里面声明了一个cookieResponse.Cookies["UserInfo"].Value = "Passport";
如何用js读取这个cookie? --------------------编程问答--------------------
var allcookies = document.cookie;
var pos = allcookies.indexOf("UserInfo=");
if (pos != -1) {
var start = pos + 9;
var end = allcookies.indexOf(";", start);
if (end == -1)
end = allcookies.length;
var value = allcookies.substring(start, end);
alert(value);
}
补充:.NET技术 , ASP.NET