Skip to the content.

CurlDotNet Tutorials

CurlDotNet tutorials for beginners: learn curl in C# step by step, from what .NET and curl are through your first Curl.ExecuteAsync request, reading results, JSON, headers, authentication, file downloads, forms, cancellation, parallel requests and debugging. All 14 tutorials are listed below in order.

What is CurlDotNet?

CurlDotNet is a pure .NET implementation of curl. You pass a curl command string to Curl.ExecuteAsync and it runs the request inside your C# application, with no shell and no curl binary required.

Installation

Install from NuGet (CurlDotNet on NuGet):

dotnet add package CurlDotNet

See the installation guide for project setup.

Tutorial Series

Foundation

  1. What is .NET and C#? - The platform, the language, and your first program
  2. What is curl? - The curl command-line tool and how its options map to CurlDotNet
  3. Understanding Async/Await - Why requests are awaited and how to run several at once

Getting Started

  1. Your First Request - Run Curl.ExecuteAsync and read the result
  2. Understanding Results - Working with CurlResult: status, headers, body
  3. Handling Errors - Status codes, EnsureSuccess, and CurlException types

Working with Data

  1. JSON for Beginners - Parsing JSON responses with ParseJson<T>
  2. Headers Explained - Sending and reading HTTP headers
  3. Authentication Basics - Basic auth, bearer tokens and API keys

Files and Forms

  1. Files and Downloads - Downloading with -o and uploading with -F
  2. Forms and Data - Submitting form data and request bodies

Advanced Concepts

  1. Cancellation Tokens - Stopping requests with CancellationToken
  2. Parallel Requests - Task.WhenAll and Curl.ExecuteManyAsync
  3. Debugging Requests - Verbose output, tracing and timings

Learning Path

Complete Beginner?

Start with Tutorial 1 to understand .NET, then work through each tutorial in order.

Know .NET but New to curl?

Jump to Tutorial 2 to understand curl, then move to Tutorial 4 for practical examples.

Experienced Developer?

Go straight to Tutorial 4, or skip the tutorials and use the quickstart and the cookbook.

Quick Example

using CurlDotNet;

var result = await Curl.ExecuteAsync("curl https://api.github.com");
Console.WriteLine(result.StatusCode);
Console.WriteLine(result.Body);

What You’ll Learn

By completing these tutorials you will understand:

Additional Resources

Need Help?

Ready to start? Begin with What is .NET and C#?.