c# - 无法在 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# - 来自 streamReader 的 C# 文件按空格拆分为 int 和 string。在第一行之后
- java - 如何在测试中注入 bean 的属性源
- javascript - 尝试使用 CDN 中的 Vue.js 库,但出现 Uncaught SyntaxError: Unexpected identifier
- php - 使用 $_GET 参数删除 MySQL 数据库的行
- c - 使用空格检测单词或句子将摩尔斯电码解码为文本的 C 程序
- python - 从客户 ID 购买日期到 python 中 ID 的购买间隔天数
- logging - 我无法按日期设置日志?如何在 log4j.prop 文件中设置 bydate?我已经应用了这些东西,但没有每天生成
- javascript - 完全动态地从 JSON 创建表
- ruby - 转换三个字节、二进制补码、有符号整数
- javascript - 姜戈;如何将javascript连接到数据库?