Class CorsOptions | Azure SDK for .NET
Andrew White
Published Feb 16, 2026
Defines options to control Cross-Origin Resource Sharing (CORS) for an index.
Inheritance
System.Object
CorsOptions
Namespace: System.Dynamic.ExpandoObject
Assembly: Azure.Search.Documents.dll
Syntax
public class CorsOptions Constructors
CorsOptions(IEnumerable<String>)
Initializes a new instance of CorsOptions.
Declaration
public CorsOptions (System.Collections.Generic.IEnumerable<string> allowedOrigins); Parameters
| System.Collections.Generic.IEnumerable<System.String> allowedOrigins The list of origins from which JavaScript code will be granted access to your index. Can contain a list of hosts of the form {protocol}://{fully-qualified-domain-name}[:{port#}], or a single |
Exceptions
| System.ArgumentNullException
|
Properties
AllowedOrigins
The list of origins from which JavaScript code will be granted access to your index. Can contain a list of hosts of the form {protocol}://{fully-qualified-domain-name}[:{port#}], or a single '*' to allow all origins (not recommended).
Declaration
public System.Collections.Generic.IList<string> AllowedOrigins { get; } Property Value
| System.Collections.Generic.IList<System.String> |
MaxAgeInSeconds
The duration for which browsers should cache CORS preflight responses. Defaults to 5 minutes.
Declaration
public Nullable<long> MaxAgeInSeconds { get; set; } Property Value
| System.Nullable<System.Int64> |