共用方式為


CorsMiddlewareExtensions.UseCors 方法

定義

多載

UseCors(IApplicationBuilder)

將 CORS 中介軟體新增至 Web 應用程式管線以允許跨網域要求。

UseCors(IApplicationBuilder, Action<CorsPolicyBuilder>)

將 CORS 中介軟體新增至 Web 應用程式管線以允許跨網域要求。

UseCors(IApplicationBuilder, String)

將 CORS 中介軟體新增至 Web 應用程式管線以允許跨網域要求。

UseCors(IApplicationBuilder)

來源:
CorsMiddlewareExtensions.cs
來源:
CorsMiddlewareExtensions.cs
來源:
CorsMiddlewareExtensions.cs

將 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

參數

app
IApplicationBuilder

傳遞至 Configure 方法的 IApplicationBuilder

傳回

原始應用程式參數

適用於

UseCors(IApplicationBuilder, Action<CorsPolicyBuilder>)

來源:
CorsMiddlewareExtensions.cs
來源:
CorsMiddlewareExtensions.cs
來源:
CorsMiddlewareExtensions.cs

將 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

參數

app
IApplicationBuilder

傳遞至 Configure 方法的 IApplicationBuilder。

configurePolicy
Action<CorsPolicyBuilder>

委派,可使用原則產生器來建置原則。

傳回

原始應用程式參數

適用於

UseCors(IApplicationBuilder, String)

來源:
CorsMiddlewareExtensions.cs
來源:
CorsMiddlewareExtensions.cs
來源:
CorsMiddlewareExtensions.cs

將 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

參數

app
IApplicationBuilder

傳遞至 Configure 方法的 IApplicationBuilder

policyName
String

已設定原則的原則名稱。

傳回

原始應用程式參數

適用於