Table of Contents

ApiKeyException Class

Definition

The exception that is thrown when the requirements of an API key header is not meet.

public class ApiKeyException : HttpStatusCodeException, ISerializable
Inheritance
ApiKeyException
Implements
Inherited Members

Examples

The following example demonstrates how a is used to signal that a request's API key header validation failed.

// Program.cs
using System;
using Microsoft.AspNetCore.Http;
using Cuemon.AspNetCore.Http.Headers;

        var exception = new ApiKeyException(StatusCodes.Status403Forbidden, "The API key was rejected.");
Console.WriteLine($"{exception.StatusCode} {exception.ReasonPhrase}");

Constructors

Name Description
ApiKeyException(int, string)

Initializes a new instance of the ApiKeyException class.

See Also