Previous Topic: Extract HTTP Headers Using PERL

Next Topic: Header Variables and End-User IP Address Validation

Extract HTTP Headers Using ASP

To access the default HTTP headers, you can extract their values from the environment and display them using an ASP script.

To use an ASP script to return SiteMinder variables, your script has to include the ALL_HTTP header, which retrieves all the environment variables, and code that parses out the SiteMinder variables. Use the following script as an example.

<HTML>
<HEAD><TITLE> Test Web Agent Headers </TITLE></HEAD>
<BODY BGCOLOR=#ffffff>
<TABLE BORDER=1>
<TR><TD VALIGN=TOP><B>Variable</B></TD><TD VALIGN=TOP><B>Value</B></TD></TR>
<% For Each key in Request.ServerVariables %>
<TR>
<TD><% = key %></TD>
<TD>
<%
if Request.ServerVariables(key) = "" Then
if GetAttribute(key) = "" Then
Response.Write "&nbsp" ' To force border around table cell
else
Response.Write GetAttribute(key)
end if
else
Response.Write Request.ServerVariables(key)
end if
Response.Write "</TD>"
%>
</TR>
<% Next %>
</TABLE>

<% Function GetAttribute(AttrName)
		Dim AllAttrs
		Dim RealAttrName
		Dim Location
		Dim Result

		AllAttrs = Request.ServerVariables("ALL_HTTP")
		RealAttrName = AttrName

		Location = instr(AllAttrs, RealAttrName & ":")

		if Location <= 0 then
		GetAttribute = ""
		Exit Function
		end if

		Result = mid(AllAttrs, Location + Len(RealAttrName) + 1)

		Location = instr(Result, chr(10))
		if Location <= 0 then Location = len(Result) + 1

		GetAttribute = left(Result, Location - 1)
End Function %>


Copyright © 2010 CA. All rights reserved. Email CA about this topic