admin管理员组文章数量:1356097
I am using ASP MVC 2.0 , i want to set Cookie from my Controller and read it from java Script i there any way to do so i have used following code in controller
HttpCookie ActiveTabs = new HttpCookie("tabs");
ActiveTabs.Values["top_navi_link"] = "ViewConference";
Response.Cookies.Add(ActiveTabs);
how to read it from java script.
I am using ASP MVC 2.0 , i want to set Cookie from my Controller and read it from java Script i there any way to do so i have used following code in controller
HttpCookie ActiveTabs = new HttpCookie("tabs");
ActiveTabs.Values["top_navi_link"] = "ViewConference";
Response.Cookies.Add(ActiveTabs);
how to read it from java script.
Share Improve this question edited Feb 13, 2012 at 13:32 Gaurav Mishra asked Feb 13, 2012 at 13:24 Gaurav MishraGaurav Mishra 711 silver badge5 bronze badges 4- 1 Use Google. w3schools./js/js_cookies.asp – CBusBus Commented Feb 13, 2012 at 13:26
-
3
@SOliver,
w3schools
? Seriously? There are also w3fools – Darin Dimitrov Commented Feb 13, 2012 at 13:30 - 1 @DarinDimitrov: Yes seriously; they provide a adequate solution to the OP's problem. w3fools are claiming that there is a lot of questionable content on the site, not that every item on it is wrong. – CBusBus Commented Feb 13, 2012 at 13:45
- I agree with SOliver here. Most of W3Schools is good info, but there are quite a few bad ones. And the bulk of the "bad ones" are very nitpicky. – Darthg8r Commented Feb 13, 2012 at 14:46
2 Answers
Reset to default 4Use this jquery jquery-cookies.js
which make it easy:
var cookiedata = $.cookie('top_navi_link');
<script type="text/javascript">
alert(document.cookie);
</script>
There are also some jquery plugins such as jquery.cookie which might simplify this task.
本文标签: how read cookie value using javascript created in Aspnet CStack Overflow
版权声明:本文标题:how read cookie value using javascript created in Asp.net C# - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744023544a2577644.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论