CorsMiddlewareExtensions.UseCors 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
UseCors(IApplicationBuilder) |
將 CORS 中介軟體新增至 Web 應用程式管線以允許跨網域要求。 |
UseCors(IApplicationBuilder, Action<CorsPolicyBuilder>) |
將 CORS 中介軟體新增至 Web 應用程式管線以允許跨網域要求。 |
UseCors(IApplicationBuilder, String) |
將 CORS 中介軟體新增至 Web 應用程式管線以允許跨網域要求。 |
UseCors(IApplicationBuilder)
將 CORS 中介軟體新增至 Web 應用程式管線以允許跨網域要求。
public:
[System::Runtime::CompilerServices::Extension]
static Microsoft::AspNetCore::Builder::IApplicationBuilder ^ UseCors(Microsoft::AspNetCore::Builder::IApplicationBuilder ^ app);
public static Microsoft.AspNetCore.Builder.IApplicationBuilder UseCors (this Microsoft.AspNetCore.Builder.IApplicationBuilder app);
static member UseCors : Microsoft.AspNetCore.Builder.IApplicationBuilder -> Microsoft.AspNetCore.Builder.IApplicationBuilder
<Extension()>
Public Function UseCors (app As IApplicationBuilder) As IApplicationBuilder
參數
傳遞至 Configure 方法的 IApplicationBuilder
傳回
原始應用程式參數
適用於
UseCors(IApplicationBuilder, Action<CorsPolicyBuilder>)
將 CORS 中介軟體新增至 Web 應用程式管線以允許跨網域要求。
public:
[System::Runtime::CompilerServices::Extension]
static Microsoft::AspNetCore::Builder::IApplicationBuilder ^ UseCors(Microsoft::AspNetCore::Builder::IApplicationBuilder ^ app, Action<Microsoft::AspNetCore::Cors::Infrastructure::CorsPolicyBuilder ^> ^ configurePolicy);
public static Microsoft.AspNetCore.Builder.IApplicationBuilder UseCors (this Microsoft.AspNetCore.Builder.IApplicationBuilder app, Action<Microsoft.AspNetCore.Cors.Infrastructure.CorsPolicyBuilder> configurePolicy);
static member UseCors : Microsoft.AspNetCore.Builder.IApplicationBuilder * Action<Microsoft.AspNetCore.Cors.Infrastructure.CorsPolicyBuilder> -> Microsoft.AspNetCore.Builder.IApplicationBuilder
<Extension()>
Public Function UseCors (app As IApplicationBuilder, configurePolicy As Action(Of CorsPolicyBuilder)) As IApplicationBuilder
參數
傳遞至 Configure 方法的 IApplicationBuilder。
- configurePolicy
- Action<CorsPolicyBuilder>
委派,可使用原則產生器來建置原則。
傳回
原始應用程式參數
適用於
UseCors(IApplicationBuilder, String)
將 CORS 中介軟體新增至 Web 應用程式管線以允許跨網域要求。
public:
[System::Runtime::CompilerServices::Extension]
static Microsoft::AspNetCore::Builder::IApplicationBuilder ^ UseCors(Microsoft::AspNetCore::Builder::IApplicationBuilder ^ app, System::String ^ policyName);
public static Microsoft.AspNetCore.Builder.IApplicationBuilder UseCors (this Microsoft.AspNetCore.Builder.IApplicationBuilder app, string policyName);
static member UseCors : Microsoft.AspNetCore.Builder.IApplicationBuilder * string -> Microsoft.AspNetCore.Builder.IApplicationBuilder
<Extension()>
Public Function UseCors (app As IApplicationBuilder, policyName As String) As IApplicationBuilder
參數
傳遞至 Configure 方法的 IApplicationBuilder
- policyName
- String
已設定原則的原則名稱。
傳回
原始應用程式參數