开发者

Watch the content of session while debugging

开发者 https://www.devze.com 2023-02-12 23:24 出处:网络
I added a watch expression for HttpContext.Current.Session I can see the Count being equal to 2 but I can开发者_如何学Python\'t find the actual content. Where do I find the content of the session whi

I added a watch expression for HttpContext.Current.Session

I can see the Count being equal to 2 but I can开发者_如何学Python't find the actual content. Where do I find the content of the session while debugging?


You need to set a watch on a specific item eg:

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

You can also query the Count which is the number of items in the sessions collection:

HttpContext.Current.Session.Count

If you want to see all the Keys you can do:

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


Try adding the watch expression for

HTTPContext.Current.Items

This is object is the key/value pair for all of the session items.

0

精彩评论

暂无评论...
验证码 换一张
取 消