Version Affected: All
Description:
When using the IIS Rewrite module an admin may be required to search the available server variables to run regex expressions on. Server variables can be found easily using a simple script on a web server to view what is available and what each contains.
Cause:
Web Services have server variables that are sent between the server and client
Resolution:
The following code can be added to a named ASPX file and placed on any IIS web server which has .Net programming enabled:
servervars.aspx
<% @ Page Language="C#" %>
<%
int loop1, loop2;
NameValueCollection coll;
// Load ServerVariable collection into NameValueCollection object.
coll=Request.ServerVariables;
// Get names of all keys into a string array.
String[] arr1 = coll.AllKeys;
for (loop1 = 0; loop1 < arr1.Length; loop1++)
{
Response.Write(arr1[loop1] + "   :   ");
String[] arr2=coll.GetValues(arr1[loop1]);
for (loop2 = 0; loop2 < arr2.Length; loop2++) {
Response.Write("<b>" + Server.HtmlEncode(arr2[loop2]) + "</b></p>");
}
}
%>
Once created and placed on the web server, browse to the file in any web browser to view all available server variables as well as the values/data they hold.
Special Considerations (optional as needed):
Not all server variables will have values/data. There are values/data that only get populated when redirect from another site, there may be some older values that are not really used in today's browsing, also.
SecureAuth Knowledge Base Articles provide information based on specific use cases and may not apply to all appliances or configurations. Be advised that these instructions could cause harm to the environment if not followed correctly or if they do not apply to the current use case.
Customers are responsible for their own due diligence prior to utilizing this information and agree that SecureAuth is not liable for any issues caused by misconfiguration directly or indirectly related to SecureAuth products.
Comments
Please sign in to leave a comment.