CorsOptions.AddPolicy 方法

定义

重载

AddPolicy(String, CorsPolicy)

添加新策略。

AddPolicy(String, Action<CorsPolicyBuilder>)

添加新策略。

AddPolicy(String, CorsPolicy)

Source:
CorsOptions.cs
Source:
CorsOptions.cs
Source:
CorsOptions.cs

添加新策略。

public:
 void AddPolicy(System::String ^ name, Microsoft::AspNetCore::Cors::Infrastructure::CorsPolicy ^ policy);
public void AddPolicy (string name, Microsoft.AspNetCore.Cors.Infrastructure.CorsPolicy policy);
member this.AddPolicy : string * Microsoft.AspNetCore.Cors.Infrastructure.CorsPolicy -> unit
Public Sub AddPolicy (name As String, policy As CorsPolicy)

参数

name
String

策略的名称。

policy
CorsPolicy

CorsPolicy 添加的策略。

适用于

AddPolicy(String, Action<CorsPolicyBuilder>)

Source:
CorsOptions.cs
Source:
CorsOptions.cs
Source:
CorsOptions.cs

添加新策略。

public:
 void AddPolicy(System::String ^ name, Action<Microsoft::AspNetCore::Cors::Infrastructure::CorsPolicyBuilder ^> ^ configurePolicy);
public void AddPolicy (string name, Action<Microsoft.AspNetCore.Cors.Infrastructure.CorsPolicyBuilder> configurePolicy);
member this.AddPolicy : string * Action<Microsoft.AspNetCore.Cors.Infrastructure.CorsPolicyBuilder> -> unit
Public Sub AddPolicy (name As String, configurePolicy As Action(Of CorsPolicyBuilder))

参数

name
String

策略的名称。

configurePolicy
Action<CorsPolicyBuilder>

可以使用策略生成器生成策略的委托。

适用于