CorsPolicyBuilder.WithOrigins(String[]) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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.