Dela via


CorsPolicyBuilder.WithOrigins(String[]) Method

Definition

Adds the specified origins to the policy.

public:
 Microsoft::AspNetCore::Cors::Infrastructure::CorsPolicyBuilder ^ WithOrigins(... cli::array <System::String ^> ^ origins);
public Microsoft.AspNetCore.Cors.Infrastructure.CorsPolicyBuilder WithOrigins (params string[] origins);
member this.WithOrigins : string[] -> Microsoft.AspNetCore.Cors.Infrastructure.CorsPolicyBuilder
Public Function WithOrigins (ParamArray origins As String()) As CorsPolicyBuilder

Parameters

origins
String[]

The origins that are allowed.

Returns

The current policy builder.

Remarks

This method normalizes the origin value prior to adding it to Origins to match the normalization performed by the browser on the value sent in the ORIGIN header.

  • If the specified origin has an internationalized domain name (IDN), the punycoded value is used. If the origin specifies a default port (e.g. 443 for HTTPS or 80 for HTTP), this will be dropped as part of normalization. Finally, the scheme and punycoded host name are culture invariant lower cased before being added to the Origins collection.
  • For all other origins, normalization involves performing a culture invariant lower casing of the host name.

Applies to