asp.net - 调试时观察 session 内容

标签 asp.net debugging session

我为 HttpContext.Current.Session 添加了一个监视表达式

我可以看到 Count 等于 2,但我找不到实际内容。调试时在哪里可以找到 session 的内容?

最佳答案

您需要对特定项目设置监视,例如:

HttpContext.Current.Session["YourKey1"]
// or
HttpContext.Current.Session["YourKey2"]

您还可以查询 Count,它是 session 集合中的项目数:

HttpContext.Current.Session.Count

如果您想查看所有Key,您可以执行以下操作:

string someKey = HttpContext.Current.Session.Keys[indexOfKeyYouWant];

关于asp.net - 调试时观察 session 内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5084228/

相关文章:

c++ - 用于 C++ 的嵌入式调试器

python - 将 requests.Session() cookie 传输到 Python 中的 selenium 网络驱动程序

java - sendRedirect() 函数的问题

c# - 如果发生异常,则退出函数/方法

c# - 如何从列表中获取不同的数据?

c# - ImageResizer/System.Drawing 和 CMYK JPEG

c# - 代理asp不加载外部xml

python - 将 CGI python 脚本附加到 PyCharm 调试器?

c++ - 嵌入 GDB 断点

javascript - session.socket.io错误: could not look up session by key: connect. sid