CorsEndpointConventionBuilderExtensions.RequireCors Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
RequireCors<TBuilder>(TBuilder) |
Adds a CORS policy with the default policy name to the endpoint(s). |
RequireCors<TBuilder>(TBuilder, Action<CorsPolicyBuilder>) |
Adds the specified CORS policy to the endpoint(s). |
RequireCors<TBuilder>(TBuilder, String) |
Adds a CORS policy with the specified name to the endpoint(s). |
RequireCors<TBuilder>(TBuilder)
Adds a CORS policy with the default policy name to the endpoint(s).
public static TBuilder RequireCors<TBuilder> (this TBuilder builder) where TBuilder : Microsoft.AspNetCore.Builder.IEndpointConventionBuilder;
static member RequireCors : 'Builder -> 'Builder (requires 'Builder :> Microsoft.AspNetCore.Builder.IEndpointConventionBuilder)
<Extension()>
Public Function RequireCors(Of TBuilder As IEndpointConventionBuilder) (builder As TBuilder) As TBuilder
Type Parameters
- TBuilder
Parameters
- builder
- TBuilder
The endpoint convention builder.
Returns
The original convention builder parameter.
Applies to
RequireCors<TBuilder>(TBuilder, Action<CorsPolicyBuilder>)
Adds the specified CORS policy to the endpoint(s).
public:
generic <typename TBuilder>
where TBuilder : Microsoft::AspNetCore::Builder::IEndpointConventionBuilder[System::Runtime::CompilerServices::Extension]
static TBuilder RequireCors(TBuilder builder, Action<Microsoft::AspNetCore::Cors::Infrastructure::CorsPolicyBuilder ^> ^ configurePolicy);
public static TBuilder RequireCors<TBuilder> (this TBuilder builder, Action<Microsoft.AspNetCore.Cors.Infrastructure.CorsPolicyBuilder> configurePolicy) where TBuilder : Microsoft.AspNetCore.Builder.IEndpointConventionBuilder;
static member RequireCors : 'Builder * Action<Microsoft.AspNetCore.Cors.Infrastructure.CorsPolicyBuilder> -> 'Builder (requires 'Builder :> Microsoft.AspNetCore.Builder.IEndpointConventionBuilder)
<Extension()>
Public Function RequireCors(Of TBuilder As IEndpointConventionBuilder) (builder As TBuilder, configurePolicy As Action(Of CorsPolicyBuilder)) As TBuilder
Type Parameters
- TBuilder
Parameters
- builder
- TBuilder
The endpoint convention builder.
- configurePolicy
- Action<CorsPolicyBuilder>
A delegate which can use a policy builder to build a policy.
Returns
The original convention builder parameter.
Applies to
RequireCors<TBuilder>(TBuilder, String)
Adds a CORS policy with the specified name to the endpoint(s).
public:
generic <typename TBuilder>
where TBuilder : Microsoft::AspNetCore::Builder::IEndpointConventionBuilder[System::Runtime::CompilerServices::Extension]
static TBuilder RequireCors(TBuilder builder, System::String ^ policyName);
public static TBuilder RequireCors<TBuilder> (this TBuilder builder, string policyName) where TBuilder : Microsoft.AspNetCore.Builder.IEndpointConventionBuilder;
static member RequireCors : 'Builder * string -> 'Builder (requires 'Builder :> Microsoft.AspNetCore.Builder.IEndpointConventionBuilder)
<Extension()>
Public Function RequireCors(Of TBuilder As IEndpointConventionBuilder) (builder As TBuilder, policyName As String) As TBuilder
Type Parameters
- TBuilder
Parameters
- builder
- TBuilder
The endpoint convention builder.
- policyName
- String
The CORS policy name.
Returns
The original convention builder parameter.