网络编程
位置:首页>> 网络编程>> Asp编程>> asp如何检测HTTP表头信息?

asp如何检测HTTP表头信息?

  发布时间:2010-06-28 18:20:00 

标签:http头,asp

如何侦测HTTP表头信息?

可用下列办法侦测并显示所有的HTTP HEADERS:


<HTML>
<HEAD>
<TITLE> HTTP HEADERS侦测 - www.aspxhome.com< /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
 %>

0
投稿

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com