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的方法
參考資料
Unable to update cookie in ASP.NET
Does modifying the Response.Cookies collection also change Request.Cookies in .Net?