<% @LANGUAGE = VBScript %>
<!-- Sample Call: YourFile.asp?ShowAll=false -->
<html>
<head>
<title>Display Server Variables</title>
</head>
<body bgcolor="#FFFFFF">
<%
Dim MyChoice, MyQuote, MyVar, MyValue, ShowAll, EmptyVars
response.write ("<h2>Server Variables</h2>")
MyChoice = Split(Request.ServerVariables("QUERY_STRING"), "=")
If UBound(MyChoice) < 0 Then 'Default to ShowAll since no argument passed
ShowAll = True
ElseIf InStr("Y,T,1", UCase(Left(MyChoice(1), 1))) > 0 Then 'Allow Yes, True, 1
ShowAll = True
End If
If ShowAll Then
'<!-- Spin through ALL Server variables -->
For Each MyVar In Request.ServerVariables
MyValue = Request.ServerVariables(MyVar)
response.write MyVar & "=<b>" & MyValue & "</b><br>"
Next
Else
EmptyVars = "<P><B>Blank Server Variables</b><br>" & vbCrLf
MyQuote = Chr(34)
'<!-- Spin through ALL Server variables placing empty ones at end of list -->
For Each MyVar In Request.ServerVariables
If InStr(MyVar, "_ALL") + InStr(MyVar, "ALL_") = 0 Then
MyValue = Trim(Request.ServerVariables(MyVar))
If Len(MyValue) = 0 Then
EmptyVars = EmptyVars & MyVar & ", "
Else
response.write "request.servervariables(" & MyQuote
response.write MyVar & MyQuote & ") "
response.write " =<br><B>" & MyValue & "</b><p>" & vbCrLf
End If
End If
Next
'Remove trailing ", "
response.write Left(EmptyVars, Len(EmptyVars) - 2)
End If
%>
</body>
</html>