Table of Contents

Class DisableCorsAttribute

Namespace
System.Web.Http.Cors
Assembly
System.Web.Http.Cors.dll

This class defines an attribute that can be applied to an action or a controller to disable CORS.

[AttributeUsage(AttributeTargets.Class|AttributeTargets.Method, AllowMultiple = false)]
public sealed class DisableCorsAttribute : Attribute, ICorsPolicyProvider
Inheritance
DisableCorsAttribute
Implements
Inherited Members

Constructors

DisableCorsAttribute()

Initializes a new instance of the DisableCorsAttribute class.

public DisableCorsAttribute()

Methods

GetCorsPolicyAsync(HttpRequestMessage, CancellationToken)

Gets the CORS policy asynchronously.

public Task<CorsPolicy> GetCorsPolicyAsync(HttpRequestMessage request, CancellationToken cancellationToken)

Parameters

request HttpRequestMessage

The request.

cancellationToken CancellationToken

The cancellation token assigned for this task.

Returns

Task<CorsPolicy>

The newly created task for this operation.