Sample code for 30+ languages & platforms
Classic ASP

Get Response Header for Method that does not Return HttpResponse Object

Demonstrates how to get the response header and individual response header fields for a method that does not return an HTTP response object. (If a method returns an HHTTP response object, then the response header information should be obtained from the response object.)

Chilkat Classic ASP Downloads

Classic ASP
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
success = 0

'  This example requires the Chilkat API to have been previously unlocked.
'  See Global Unlock Sample for sample code.

set http = Server.CreateObject("Chilkat.Http")

strHtml = http.QuickGetStr("https://www.duckduckgo.com/")
If (http.LastMethodSuccess = 0) Then
    Response.Write "<pre>" & Server.HTMLEncode( http.LastErrorText) & "</pre>"
    Response.End
End If

Response.Write "<pre>" & Server.HTMLEncode( http.LastResponseHeader) & "</pre>"

'  Here's a sample HTTP response header:

'  Server: nginx
'  Date: Wed, 30 Sep 2020 13:13:02 GMT
'  Content-Type: text/html; charset=UTF-8
'  Transfer-Encoding: chunked
'  Connection: keep-alive
'  Vary: Accept-Encoding
'  ETag: W/"5f7371f4-1683"
'  Strict-Transport-Security: max-age=31536000
'  X-Frame-Options: SAMEORIGIN
'  Content-Security-Policy: default-src https: blob: data: 'unsafe-inline' 'unsafe-eval'; frame-ancestors 'self'
'  X-XSS-Protection: 1;mode=block
'  X-Content-Type-Options: nosniff
'  Referrer-Policy: origin
'  Expect-CT: max-age=0
'  Expires: Wed, 30 Sep 2020 13:13:01 GMT
'  Cache-Control: no-cache
'  Content-Encoding: gzip

'  We can load it into a Chilkat MIME object to get header field values:
set mime = Server.CreateObject("Chilkat.Mime")

success = mime.LoadMime(http.LastResponseHeader)
If (success = 0) Then
    Response.Write "<pre>" & Server.HTMLEncode( mime.LastErrorText) & "</pre>"
    Response.End
End If

'  Get MIME header field values using Chilkat MIME...
Response.Write "<pre>" & Server.HTMLEncode( "----") & "</pre>"
Response.Write "<pre>" & Server.HTMLEncode( "ETag: " & mime.GetHeaderField("ETag")) & "</pre>"

%>
</body>
</html>