Table of Contents

UserAgentException Class

Definition

The exception that is thrown when the requirements of an HTTP User-Agent header is not meet.

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

Examples

The following example demonstrates how a is used to signal that a request's User-Agent header was rejected.

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

        var exception = new UserAgentException(StatusCodes.Status400BadRequest, "The User-Agent header is required.");
Console.WriteLine($"{exception.StatusCode} {exception.ReasonPhrase}");

Constructors

Name Description
UserAgentException(int, string)

Initializes a new instance of the UserAgentException class.

See Also