Chilkat Examples

ChilkatHOMEAndroid™Classic ASPCC++C#Mono C#.NET Core C#C# UWP/WinRTDataFlexDelphi ActiveXDelphi DLLVisual FoxProJavaLianjaMFCObjective-CPerlPHP ActiveXPHP ExtensionPowerBuilderPowerShellPureBasicCkPythonChilkat2-PythonRubySQL ServerSwift 2Swift 3/4TclUnicode CUnicode C++Visual Basic 6.0VB.NETVB.NET UWP/WinRTVBScriptXojo PluginNode.jsExcelGo

C# Examples

ASN.1
Amazon S3
Amazon S3 (new)
Amazon SES
Amazon SNS
Amazon SQS
Async
Azure Cloud Storage
Azure Service Bus
Bounced Email
Box
CSR
CSV
Certificates
Compression
DKIM / DomainKey
DSA
Diffie-Hellman
Digital Signatures
Dropbox
Dynamics CRM
ECC
Email Object
Encryption
FTP
Facebook
Firebase
GMail REST API
GeoOp
Google APIs
Google Calendar
Google Cloud Storage
Google Drive
Google Sheets
Gzip
HTML-to-XML/Text
HTTP
HTTP Misc
IMAP
JSON
JSON Web Encryption (JWE)
JSON Web Signatures (JWS)
JSON Web Token (JWT)
Java KeyStore (JKS)

Jira
MHT / HTML Email
MIME
Microsoft Graph
NTLM
OAuth1
OAuth2
OneDrive
OpenSSL
Outlook
PEM
PFX/P12
POP3
PRNG
PayPal
Peoplevox
QuickBooks
REST
REST Misc
RSA Encryption
SCP
SFTP
SMTP
SSH
SSH Key
SSH Tunnel
SharePoint
Shopify
Socket/SSL/TLS
Spider
Stream
Stripe
SugarCRM
Tar Archive
Twitter
Upload
VoiceBase
Walmart
WebSocket
XAdES
XML
XML Digital Signatures
XMP
Xero
Zip
curl
eBay

 

 

 

(C#) HTTP HEAD Request

Sends an HTTP HEAD request and gets the response.

Note: The response to an HTTP HEAD request is always just the response header. The reponse body is always 0 length (thus the reason it's called a "HEAD" request..)

Chilkat .NET Downloads

Chilkat .NET Assemblies

Chilkat for .NET Core

Chilkat for Mono

Chilkat.Http http = new Chilkat.Http();

//  Any string unlocks the component for the 1st 30 days.
bool success = http.UnlockComponent("Anything for 30-day trial");
if (success != true) {
    Console.WriteLine(http.LastErrorText);
    return;
}

//  If the URL uses "https://", then the connection will be TLS.
//  Otherwise it will be TCP.
Chilkat.HttpResponse response = http.GetHead("https://example-code.com/");
if (http.LastMethodSuccess != true) {
    //  A failure is when we don't get any response.  It could be a timeout, an inability to connect, etc.
    //  For example, a "404 Not Found" response is still a response, and thus deemed success in terms of the API..
    Console.WriteLine(http.LastErrorText);
    return;
}

//  Examine the response.
Console.WriteLine("Status Code = " + Convert.ToString(response.StatusCode));
Console.WriteLine("Status Line = " + response.StatusLine);
Console.WriteLine("Status Text = " + response.StatusText);
Console.WriteLine("Full Response Header:");
Console.WriteLine(response.Header);
Console.WriteLine("----");
int numHeaderFields = response.NumHeaderFields;
Console.WriteLine("Num Header Fields: " + Convert.ToString(numHeaderFields));
int i;
for (i = 0; i <= numHeaderFields - 1; i++) {
    Console.WriteLine(response.GetHeaderName(i) + ": " + response.GetHeaderValue(i));
}


 

© 2000-2016 Chilkat Software, Inc. All Rights Reserved.