Class
CrossOriginResourceSharingHeaders
Provides a class to provide Cross Origin response headers for when communicating with a browser.
public sealed class CrossOriginResourceSharingHeadersInheritance #
object ← CrossOriginResourceSharingHeaders
Inherited Members #
object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Constructors #
| Name | Description |
|---|---|
| CrossOriginResourceSharingHeaders() | Creates an empty CrossOriginResourceSharingHeaders instance with no predefined CORS headers. |
| CrossOriginResourceSharingHeaders(string?, string[]?, string[]?, string[]?, string[]?, TimeSpan?, bool) | Initializes a new instance of the CrossOriginResourceSharingHeaders class with the specified CORS headers. |
Fields #
| Name | Description |
|---|---|
| AutoAllowOrigin | When applied to the AllowOrigin property, the HTTP server automatically applies the incoming request Origin header value to the Access-Control-Allow-Origin header. |
| AutoFromRequestHeaders | When applied to the AllowHeaders property, the HTTP server automatically applies the incoming request headers to the Access-Control-Allow-Origin header. |
| AutoFromRequestMethod | When applied to the AllowMethods property, the HTTP server automatically applies the incoming request method to the Access-Control-Allow-Origin header. |
Properties #
| Name | Description |
|---|---|
| AllowCredentials | Gets or sets the Access-Control-Allow-Credentials header indicates whether or not the response to the request can be exposed when the credentials flag is true. When used as part of a response to a preflight request, this indicates whether or not the actual request can be made using credentials. |
| AllowHeaders | Gets or sets the Access-Control-Allow-Headers header is used in response to a preflight request to indicate which HTTP headers can be used when making the actual request. |
| AllowMethods | Gets or sets the Access-Control-Allow-Methods header specifies the method or methods allowed when accessing the resource. |
| AllowOrigin | From MDN: Access-Control-Allow-Origin specifies either a single origin which tells browsers to allow that origin to access the resource; or else — for requests without credentials — the “*” wildcard tells browsers to allow any origin to access the resource. |
| AllowOrigins | Gets or sets domains which will define the source header according to one of the domains present below. |
| Empty | Gets an instance of an empty CrossOriginResourceSharingHeaders. |
| ExposeHeaders | Gets or sets the Access-Control-Expose-Headers header adds the specified headers to the allowlist that JavaScript in browsers is allowed to access. |
| MaxAge | Gets or sets the Access-Control-Max-Age header indicates how long the results of a preflight request can be cached. |
Methods #
| Name | Description |
|---|---|
| CreatePublicContext() | Create an instance of Cross-Origin Resource Sharing that allows any origin, any method and any header in the request. |