asp.net – 在javascript中读取cookie
发布时间:2020-12-15 23:57:30 所属栏目:asp.Net 来源:网络整理
导读:这是我的asp代码,可以在Javascript中完成吗? HttpCookie cookie = this.Request.Cookies["Votes"];if (cookie != null) if (cookie.Values.Get(id.ToString()) == "true") return true;return false; 解决方法 function readTheCookie(the_info){// load th
这是我的asp代码,可以在Javascript中完成吗?
HttpCookie cookie = this.Request.Cookies["Votes"]; if (cookie != null) if (cookie.Values.Get(id.ToString()) == "true") return true; return false; 解决方法function readTheCookie(the_info) { // load the cookie into a variable and unescape it var the_cookie = document.cookie; var the_cookie = unescape(the_cookie); // separate the values from the cookie name var broken_cookie = the_cookie.split("some parameter"); // parameter depends on how the cookie is stored var the_values = broken_cookie["some index"]; // index of the value that you want } 这些都是阅读cookie的所有部分,您可以使用此片段来实现您想要的效果. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- asp.net-mvc – 哪一层应该构建一个View Model?
- asp-classic – 使用FileSystemObject的文件权限 – CScrip
- .net – 通过互联网向银行收取的最简单的方法是什么?
- asp.net – 检查是否在集成管道模式
- asp.net-mvc – Firefox在Ajax请求重定向期间不保留自定义标
- asp.net – Jquery隐藏字段
- ASP.Net MVC与Classic ASP(不是ASP.Net – 原始ASP)有何不同
- 如何单元测试我的asp.net-mvc控制器的OnActionExecuting方法
- asp.net-webpages – Razor代码块使用
- asp.net 解析json数据
推荐文章
站长推荐
- 如何在服务器端缓存ASP.NET自定义HttpHandler响应
- asp.net-mvc – 将组成员身份添加到自定义成员资
- asp.net – 绑定TemplateItem中CheckBox的Checke
- asp.net – .Net ADO连接类
- ABP官方文档(四十一)【CSRF和XSRF保护】
- asp.net-mvc – 显示主键是一种危险
- ASP.NET -- 一般处理程序ashx
- .net – log4net – FileAppender在文件开头写入
- asp.net-mvc – Razor MVC4 Url.Action无效
- asp.net-mvc – 如何扩展/架构ASP.NET MVC 3授权
热点阅读