Printing all session / post / get variables on an ASP.NET page

I am very new to ASP.NET, I'm quite used to PHP (which, unfortunately, we do not use at work) I would like to print all the session variables. In PHP, it's pretty simple, I use:

echo '<pre>' . print_r($_SESSION, true) . '</pre>';

for this, but is there a simple ASP.NET equivalent?

+5
source share
3 answers

with the field being the label.

foreach (string i in Session.Contents) {
  if (Session[i] != null) {
    box.Text += i + " = " + Session[i].ToString() + "\n";
  }
}
+5
source

The easiest way is to simply enable tracing. This will show you all this information automatically. You can do this on the page or at the application level.

The following is a quick guide .

+6
source

HttpRequest.Params:

Gets a combined set of QueryString, Form, ServerVariables, and Cookies.

+4
source

All Articles