asp获取http表头信息

<html>

<head>

<title> HTTP headERS侦测< /title>

</head>

<body>

<TABLE BORDER=1>

<tr><td VALIGN=TOP><B>变量</B></td>

<td VALIGN=TOP><B>值</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 " "

Else

Response.Write GetAttribute(key)

End If

Else

Response.Write Request.ServerVariables(key)

End If

Response.Write "</td>"

%>

</tr>

<% Next %>

</TABLE>

</body></html>


<%

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

%>


本文来自: 脚本之家(http://www.jb51.net/) 详细出处参考:http://www.jb51.net/article/4668.htm

posted @ 2009-09-05 11:50  坐看风起  阅读(687)  评论(0编辑  收藏  举报