Show / Hide Table of Contents

Class CorsOptionsMiddleware

Middleware to process OPTIONS requests when CORS is enabled.

This middleware is necessary because POST request don´t work even with CORS enabled. This is because browsers send an OPTIONS request before the POST request which is not proccesed by the Api.

This middleware is added by the CorsHandler class, so you don´t have to worry for adding it from the Startup.cs class.

Inheritance
System.Object
CorsOptionsMiddleware
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ToString()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: Celerik.NetCore.Web
Assembly: cs.temp.dll.dll
Syntax
public class CorsOptionsMiddleware

Constructors

CorsOptionsMiddleware(RequestDelegate, IHostingEnvironment)

Initializes a new instance of the class.

Declaration
public CorsOptionsMiddleware(RequestDelegate next, IHostingEnvironment environment)
Parameters
Type Name Description
RequestDelegate next

The object that can process the HTTP request.

IHostingEnvironment environment

Provides information about the web hosting environment.

Methods

Invoke(HttpContext)

Process the request for this middleware.

Declaration
public Task Invoke(HttpContext context)
Parameters
Type Name Description
HttpContext context

Object with all HTTP-specific information.

Returns
Type Description
Task

The task result.

In This Article
Back to top Generated by DocFX