Skip to content

asp .net Cookies

L edited this page Nov 1, 2018 · 2 revisions

Request.Cookies和Response.Cookies

When validating cookies or cookie data from the browser you should use the Request.Cookies collection. 
从浏览器验证cookie或cookie数据时,应该使用Request.Cookies集合
When you are constructing cookies to be sent to the browser you need to add them to the Response.Cookies collection.
在构建要发送到浏览器的cookie时,需要将它们添加到Response.Cookies集合中

参考资料

https://stackoverflow.com/questions/11287852/cookie-does-not-work-in-asp-net

更新、删除cookie失败的问题

问题的核心是,在浏览器进行cookie操作而不是在后台
所以需要在前端通过ajax调用操作cookie的方法

参考资料

https://stackoverflow.com/questions/8908345/unable-to-update-cookie-in-asp-net https://stackoverflow.com/questions/16219775/does-modifying-the-response-cookies-collection-also-change-request-cookies-in-n

Clone this wiki locally