I want to display all the session information of my asp.net page (aspx) in the page. How can I do that?
The programming language is C#.
These two methods is working for me, improved and corrected David's answer slightly:
for (int i = 0; i < Session.Count; i++)
{
var crntSession = Session.Keys[i];
Response.Write(string.Concat(crntSession, "=", Session[crntSession]) + "<br />");
}
foreach (var crntSession in Session)
{
Response.Write(string.Concat(crntSession , "=", Session[crntSession .ToString()]) + "<br />");
}
Display in listbox ( Adding for personal reference)
int[] array = new int[400];
for (int i = 0; i < Session.Count; i++)
{
var crntSession = Session.Keys[i];
lstbx.Items.Add(crntSession + "=" + Session[crntSession] + "<br />");
}
foreach (string s in Session) {
Response.Write(string.Concat(s, "=", Session[s]));
}