ASP on IIS – are you listening? Tell me your configuration
Sometimes you add and configure an IIS site and you just don’t get an answer using http or https. this happend to me yesterday so i decided to dig a little and get a better understanding of whats going on. when i started developing Active Server Pages (ASP) back in the year 2000 (i feel like a dinosaur…) i often used Request.ServerVariables to shed a light into a configured web-site on IIS. Request.ServerVariables is something simliar like phpinfo() for PHP but for ASP/.NET.
I just created the following script. To use it, just setup IIS, add/create a Web Site and save the script as default.aspx. Don’t forget to delete it afterwards, because it contains data not ment for the public.
<%@ Page Language="C#" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title><% Response.Write(Request.ServerVariables["HTTP_HOST"]); %></title>
<meta name="author" content="Solvia GmbH, Christian Casutt">
<meta name="description" content="A page to return ServerVariabes from request">
<style>
body {
font-size: 1.0em;
line-height: 1.2;
font-weight: 100;
font-family: "Raleway", "HelveticaNeue", "Helvetica Neue", Helvetica, Arial, sans-serif;
color: black;
}
th,
td {
font-size: 0.8em;
padding: 2px 5px;
text-align: left;
</style>
</head>
<body>
<p>HTTP_HOST: <% Response.Write("<b>" + Request.ServerVariables["HTTP_HOST"] + "</b>"); %></p>
<table border="1">
<tr>
<td><b>Server Variable</b></td>
<td><b>Value</b></td>
</tr>
<% foreach (string var in Request.ServerVariables)
{
Response.Write("<tr><td>" + var + "</td><td> " + Request[var] + "</td></tr>");
}
%>
</tr >
</table>
</body>
</html>
if you should receive/get a HTTP Error 404.3 – Not Found error, make sure the following two features are enabled:
Enable-WindowsOptionalFeature -FeatureName IIS-ASP -Online
Enable-WindowsOptionalFeature -FeatureName IIS-ASPNET -online -All