Get Headers Function   
 
GetHeaders returns all headers sent to the current web page by a given user's browser.

GetHeaders returns a reference to a Scripting.Dictionary object.
The Keys and Items collections will be filled with all header name, value combinations sent by the browser.

Syntax: Set object = GetHeaders()

Example Usage:
        <%
            '--------------------------------------------------------------
            'get all headers
            '--------------------------------------------------------------
            Dim oHeaders, key

            Set oHeaders = GetHeaders
            For Each key in oHeaders.Keys
                Response.write key & "<BR>"
                Response.Write oHeaders.Item(key) & "<BR><BR>"
            Next
            Set oHeaders = Nothing


            '--------------------------------------------------------------
            'get the user agent of the browser.
            '--------------------------------------------------------------
            Set oHeaders = GetHeaders
            key = oHeaders.Item("user-agent")
            Set oHeaders = Nothing
        %>

Source Code:
<%
Private Function GetHeaders()
    dim item, d, sKey, sItem

    set d = createobject("Scripting.Dictionary")
    d.RemoveAll

    for each item in request.servervariables
        if left(ucase(item), 5) = "HTTP_" then
            sKey = replace(right(UCASE(item), len(item) - 5), "_", "-")
            sItem = request.servervariables(item)
            if not d.Exists(sKey) then d.Add sKey, sItem     
        end if
    next

    Set GetHeaders = d
End Function
%>

The Result:

CACHE-CONTROL
no-cache

CONNECTION
close

PRAGMA
no-cache

ACCEPT
text/html,application/xhtml+xml,text/xml;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5

ACCEPT-CHARSET
ISO-8859-1,utf-8;q=0.7,*;q=0.7

ACCEPT-ENCODING
gzip

ACCEPT-LANGUAGE
en-us,en;q=0.5

COOKIE
ASPSESSIONIDSCRRDRRQ=MKPJMELAFOEAIEGLJBLAHIAH

HOST
www2.psacake.com:81

USER-AGENT
CCBot/1.0 (+http://www.commoncrawl.org/bot.html)

X-CC-ID
ccc03-02

X-REWRITE-URL
/web/ic.asp


My3C's
perrychicker
It's easy... it's a PSACAKE!
Back | Tell A Friend | Search this Site
© 1998 - 2010 psacake.com
Version 3.23

Send me One Million FREE Guaranteed Visitors