This gist repository contains C# examples that accompany the Message Handlers chapter in the Aspose.HTML for .NET documentation. These examples demonstrate how to process web service requests and responses using various message handlers, including logging execution time, implementing custom schemes, working with ZIP archives, managing network operation timeouts, and handling password-based authentication schemes.
In this repository, you will find code illustrating various popular use cases for message handlers, including:
- Implementing Custom Schemes – Examples of creating a message handler to process requests for a custom URI scheme.
- Working with ZIP Archives – Demonstrations of handling HTML documents and associated resources (images, styles, scripts) packed into a ZIP archive. Includes converting HTML from a ZIP archive to PDF and converting HTML from a ZIP archive to JPG.
- Authentication – A simple example of creating a custom message handler for web requests using password-based authentication schemes such as Basic, Digest, NTLM, and Kerberos.
- Logging Web Request Execution Time – Examples of tracking and logging the total execution time of a web request.
- Network Timeouts – Practical examples of configuring and managing network timeouts.
- Network Request Inspection – Examples of intercepting requests, blocking unwanted external network requests, and replacing URLs with other values.
The C# code snippets are self-contained and intended to provide a quick start when learning and integrating Aspose.HTML for .NET into your own projects.
- Install the latest version of Aspose.HTML for .NET using NuGet.
- Browse the gists in this repository and copy the relevant code into your project.
- Adjust the paths, settings, and input parameters to fit your environment.
- Run your project to see the example in action.
You can download a free trial of Aspose.HTML for .NET and use a temporary license for unrestricted access.
Comprehensive explanations and full context for each example can be found in the Message Handlers chapter of the official documentation.
- Documentation – Aspose.HTML for .NET
- Product page – Aspose.HTML for .NET
- Blog – Aspose.HTML Product Family
- API Reference – Aspose.HTML for .NET
- NuGet Package – Aspose.HTML for .NET
To run the examples, you need:
- .NET 5.0, .NET Core, or .NET Framework installed on your machine.
- Supported OS: Windows, Linux, macOS.
- The Aspose.HTML for .NET library (you can install it via NuGet:
Install-Package Aspose.Html).