asp .net Cookies

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集合中

參考資料

Cookie does not work in asp.net前端

更新、刪除cookie失敗的問題

問題的核心是,在瀏覽器進行cookie操做而不是在後臺
因此須要在前端經過ajax調用操做cookie的方法ajax

參考資料

Unable to update cookie in ASP.NET
Does modifying the Response.Cookies collection also change Request.Cookies in .Net?瀏覽器

相關文章
相關標籤/搜索