首页 > 解决方案 > 无法在 asp.net 中读取 cookie

问题描述

我的 asp.net 网页表单 page_load 中有一个代码

 if(HttpContext.Current.Request.Cookies["timezoneoffset"] != null)
 {
     HttpContext.Current.Session["timezoneoffset"] = HttpContext.Current.Request.Cookies["timezoneoffset"].Value;
 }
 else
 {
     HttpContext.Current.Session["timezoneoffset"] = 0;
 }

当我调试控制流过 if 块时。但是当我部署它时,它会去别的地方。有人可以帮我阅读这个 cookie 并将其设置为会话吗?

标签: c#asp.net

解决方案


推荐阅读