Chilkat HOME Android™ Classic ASP C C++ C# Mono C# .NET Core C# C# UWP/WinRT DataFlex Delphi ActiveX Delphi DLL Visual FoxPro Java Lianja MFC Objective-C Perl PHP ActiveX PHP Extension PowerBuilder PowerShell PureBasic CkPython Chilkat2-Python Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ Visual Basic 6.0 VB.NET VB.NET UWP/WinRT VBScript Xojo Plugin Node.js Excel Go
(VB.NET UWP/WinRT) Get Response Header for Method that does not Return HttpResponse ObjectDemonstrates 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.)
' This example requires the Chilkat API to have been previously unlocked. ' See Global Unlock Sample for sample code. Dim http As New Chilkat.Http Dim strHtml As String = Await http.QuickGetStrAsync("https://www.duckduckgo.com/") If (http.LastMethodSuccess = False) Then Debug.WriteLine(http.LastErrorText) Exit Sub End If Debug.WriteLine(http.LastResponseHeader) ' 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: Dim mime As New Chilkat.Mime Dim success As Boolean = mime.LoadMime(http.LastResponseHeader) If (success = False) Then Debug.WriteLine(mime.LastErrorText) Exit Sub End If ' Get MIME header field values using Chilkat MIME... Debug.WriteLine("----") Debug.WriteLine("ETag: " & mime.GetHeaderField("ETag")) |
© 2000-2022 Chilkat Software, Inc. All Rights Reserved.