For example, when you directly request an image, the server returns the following HTTP header:
Reference content
HTTP/1.1 200 OK
Content-Length: 48150
Content-Type: image/jpeg
Last-Modified: Tue, 18 Dec 2012 15:01:50 GMT
Accept-Ranges: bytes
ETag: "e119ee9b30ddcd1: 1c48"
Server: Microsoft-Microsoft IIS/6.0
X-Powered-By: ASP. NET
Date: Sat, 06 Sep 2014 08:07:17 GMT
Use Server. Transfer to redirect to the image:
<% Server. Transfer ("/test.jpg") %>
The HTTP header of the server response is as follows:
Reference content
HTTP/1.1 200 OK
Date: Sat, 06 Sep 2014 08:08:23 GMT
Server: Microsoft-Microsoft IIS/6.0
X-Powered-By: ASP. NET
Content-Length: 48150
Content-Type: text/html
Set-Cookie: ASPSESSIONIDCABATASQ = HCKPNPPAECAKPBJJNHOENINF; path =/
Cache-control: private
Problems
· The Content-Type value image/jpeg cannot be returned correctly;
· The HTTP header lacks the Last-Modified and ETag, which invalidates the cache mechanism;
This is due to the design of Server. Transfer and should not be resolved. ASP. NET can use RewritePath instead to implement server-side redirection.