- - - - - - - - - - - - - - - - - - - - - - - - - -
<% Server.Transfer "1.htm" %> <p>this is 1.htm</p>
<% Response.Redirect "1.htm" %>
请求:头部
GET /1.asp HTTP/1.1
Accept: */*
Accept-Language: zh-cn
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)
Host: localhost:8080
Connection: Keep-Alive
Cookie: ASPSESSIONIDACCTRTTT=PKKDJOPBAKMAMBNANIPIFDAP
@Server.Transfer应答: //直接在服务端执行1.htm并返回结果.对客户端而言是透明的.
HTTP/1.1 200 OK
Server: Microsoft-IIS/5.1
Date: Sat, 31 May 2008 12:52:44 GMT
X-Powered-By: ASP.NET
Content-Length: 20
Content-Type: text/html
Cache-control: private
<p>this is 1.htm</p>
@Response.Redirect应答: //通知客户端做重定向.
HTTP/1.1 302 Object moved
Server: Microsoft-IIS/5.1
Date: Sat, 31 May 2008 12:55:57 GMT
X-Powered-By: ASP.NET
Location: 1.htm
Content-Length: 121
Content-Type: text/html
Cache-control: private
<head><title>Object moved</title></head>
<body><h1>Object Moved</h1>This object may be found <a HREF="">here</a>.</body>
客户端收到Http302后,根据Location提供的文件地址.重新请求:
GET /1.htm HTTP/1.1
Accept: */*
Accept-Language: zh-cn
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)
Host: localhost:8080
Connection: Keep-Alive
If-Modified-Since: Thu, 06 Mar 2008 06:50:13 GMT
If-None-Match: "b224758ec53dc61:9f0"
Cookie: ASPSESSIONIDACCTRTTT=PKKDJOPBAKMAMBNANIPIFDAP
第二次应答:
HTTP/1.1 200 OK
Server: Microsoft-IIS/5.1
X-Powered-By: ASP.NET
Date: Sat, 31 May 2008 12:55:57 GMT
Content-Type: text/html
Accept-Ranges: bytes
Last-Modified: Sat, 31 May 2008 12:52:32 GMT
ETag: "76d85bd51c41c61:9f0"
Content-Length: 20
<p>this is 1.htm</p>
附: 其它常见Http Response Head:
HTTP/1.1 401 Access Denied
Server: Microsoft-IIS/5.1
Date: Sat, 31 May 2008 09:15:55 GMT
WWW-Authenticate: Negotiate
WWW-Authenticate: NTLM
Connection: close
Content-Length: 3964
Content-Type: text/html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html dir=ltr>
……
HTTP/1.1 403 Access Forbidden
Server: Microsoft-IIS/5.1
Date: Sat, 31 May 2008 08:57:39 GMT
Connection: close
Content-Type: text/html
Content-Length: 172
<html><head><title>Directory Listing Denied</title></head>
<body>...</body></html>
HTTP/1.1 404 Not Found
Date: Sat, 31 May 2008 09:03:14 GMT
Server: Apache/2.0.55 (Unix) PHP/5.0.5
Content-Length: 291
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Content-Type: text/html; charset=iso-8859-1
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head>
<body>...</body>
</html>