Blazor Server App - How to loop through request server variables

466 views Asked by At

In classic ASP, the way to loop through all request's server variables was like this:

for each x in Request.ServerVariables
   response.write(x & " = " & Request.ServerVariables(x) & "<br />")
next

To get an individual variable such as http_user_agent you would call

Request.ServerVariables("http_user_agent")

In ASP.NET, you run

 foreach (string s in Request.Params.Keys)
     s.ToString() + " - " + Request.Params[s];

Session variables are obtained like this:

 foreach (string s in Session.Keys)
            s.ToString() + " - " + Session[s];

How can I loop through server and session variables in a Blazor server app running on an IIS server?

0

There are 0 answers