NotAcceptableException Class
Definition
- Namespace
- Cuemon.AspNetCore.Http
- Assemblies
- Cuemon.AspNetCore.dll
The exception that is thrown when the web server, after performing server-driven content negotiation, does not find any content that conforms to the criteria given by the user agent.
public class NotAcceptableException : HttpStatusCodeException, ISerializable
- Inheritance
-
NotAcceptableException
- Implements
- Inherited Members
Examples
The following example demonstrates how to instantiate NotAcceptableException with a descriptive message and inspect its HTTP 406 status code and reason phrase.
// Program.cs
using System;
using Cuemon.AspNetCore.Http;
var acceptHeader = "application/xml";
var exception = new NotAcceptableException($"The endpoint cannot produce '{acceptHeader}'.");
Console.WriteLine(exception.Message);
Console.WriteLine(exception.StatusCode);
Console.WriteLine(exception.ReasonPhrase);
Constructors
| Name | Description |
|---|---|
| NotAcceptableException() | Initializes a new instance of the NotAcceptableException class. |
| NotAcceptableException(Exception) | Initializes a new instance of the NotAcceptableException class. |
| NotAcceptableException(string, Exception) | Initializes a new instance of the MethodNotAllowedException class. |