CorsEndpointConventionBuilderExtensions.RequireCors 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
RequireCors<TBuilder>(TBuilder) |
將預設原則名稱的 CORS 原則新增至端點 () 。 |
RequireCors<TBuilder>(TBuilder, Action<CorsPolicyBuilder>) |
將指定的 CORS 原則新增至端點 () 。 |
RequireCors<TBuilder>(TBuilder, String) |
將具有指定名稱的 CORS 原則新增至端點 () 。 |
RequireCors<TBuilder>(TBuilder)
將預設原則名稱的 CORS 原則新增至端點 () 。
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
類型參數
- TBuilder
參數
- builder
- TBuilder
端點慣例產生器。
傳回
TBuilder
原始慣例產生器參數。
適用於
RequireCors<TBuilder>(TBuilder, Action<CorsPolicyBuilder>)
將指定的 CORS 原則新增至端點 () 。
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
類型參數
- TBuilder
參數
- builder
- TBuilder
端點慣例產生器。
- configurePolicy
- Action<CorsPolicyBuilder>
委派,可使用原則產生器來建置原則。
傳回
TBuilder
原始慣例產生器參數。
適用於
RequireCors<TBuilder>(TBuilder, String)
將具有指定名稱的 CORS 原則新增至端點 () 。
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
類型參數
- TBuilder
參數
- builder
- TBuilder
端點慣例產生器。
- policyName
- String
CORS 原則名稱。
傳回
TBuilder
原始慣例產生器參數。