Request.ServerVariables.Keys returns empty

61 Views Asked by At

I am trying to write a simple .asp file that displays all of the keys and values from Request.ServerVariables, and, somehow, I am not able to find anything within Reuqest.ServerVariables.

This is my test.asp:

<%@ language="Javascript" %>
<!-- #include file="scripts/testjs.asp" -->
<!DOCTYPE html>
<html>
<head>
</head>
<body onload="displayUserStuff()">
<p id="userstuff"></p>
</body>
</html>

This .asp file calls another .asp file that will transfer the list from Request.ServerVariables into a JavaScript string for display, called testjs.asp:

<%
var html = "";

for (var prop in Request.ServerVariables.Keys) {
    Response.Write("X<br>");
    html += prop +  "<br />\n";
}

%>
<script>
function displayUserStuff() {
    document.getElementById('userstuff').innerHTML = '<%= Request.ServerVariables("ALL_RAW") %> <%= html %>';
}
</script>

However, whenever I run test.asp, the page is empty. Nothing apparently occurs in the loop, and I am unsure as to why.

Environment: Windows 10, IIS 8, Classic ASP, and JavaScript

0

There are 0 best solutions below