CorsOptions.AddPolicy 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
AddPolicy(String, CorsPolicy) |
新增原則。 |
AddPolicy(String, Action<CorsPolicyBuilder>) |
新增原則。 |
AddPolicy(String, CorsPolicy)
新增原則。
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>)
新增原則。
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>
委派,可使用原則產生器來建置原則。