ExceptionFilterAttribute Class

An abstract filter that runs asynchronously after an action has thrown an System.Exception. Subclasses must override Microsoft.AspNetCore.Mvc.Filters.ExceptionFilterAttribute.OnException(Microsoft.AspNetCore.Mvc.Filters.ExceptionContext) or Microsoft.AspNetCore.Mvc.Filters.ExceptionFilterAttribute.OnExceptionAsync(Microsoft.AspNetCore.Mvc.Filters.ExceptionContext) but not both.

Namespace
Microsoft.AspNetCore.Mvc.Filters
Assemblies
  • Microsoft.AspNetCore.Mvc.Core

Syntax

[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true, Inherited = true)]
public abstract class ExceptionFilterAttribute : Attribute, _Attribute, IAsyncExceptionFilter, IExceptionFilter, IOrderedFilter, IFilterMetadata
class Microsoft.AspNetCore.Mvc.Filters.ExceptionFilterAttribute

Methods

OnException(Microsoft.AspNetCore.Mvc.Filters.ExceptionContext)
public virtual void OnException(ExceptionContext context)
OnExceptionAsync(Microsoft.AspNetCore.Mvc.Filters.ExceptionContext)
Return type:System.Threading.Tasks.Task
public virtual Task OnExceptionAsync(ExceptionContext context)

Properties

Microsoft.AspNetCore.Mvc.Filters.ExceptionFilterAttribute.Order
Return type:System.Int32
public int Order { get; set; }