RazorPagesOptions.AllowDefaultHandlingForOptionsRequests Property
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.
Gets or sets a value that determines if HTTP requests with the OPTIONS method are handled by default, if no handler is available.
public:
property bool AllowDefaultHandlingForOptionsRequests { bool get(); void set(bool value); };
public bool AllowDefaultHandlingForOptionsRequests { get; set; }
member this.AllowDefaultHandlingForOptionsRequests : bool with get, set
Public Property AllowDefaultHandlingForOptionsRequests As Boolean
Property Value
The default value is true
if the version is
Version_2_2 or later; false
otherwise.
Remarks
Razor Pages uses the current request's HTTP method to select a handler method. When no handler is available or selected, the page is immediately executed. This may cause runtime errors if the page relies on the handler method to execute and initialize some state. This setting attempts to avoid this class of error for HTTP OPTIONS
requests by returning a 200 OK
response.
This property is associated with a compatibility switch and can provide a different behavior depending on the configured compatibility version for the application. See CompatibilityVersion for guidance and examples of setting the application's compatibility version.
Configuring the desired of the value compatibility switch by calling this property's setter will take precedence over the value implied by the application's CompatibilityVersion.
If the application's compatibility version is set to Version_2_2 then this setting will have value true
unless explicitly configured.
If the application's compatibility version is set to Version_2_1 or lower then this setting will have value true
unless explicitly configured.