RazorPagesOptions.AllowMappingHeadRequestsToGetHandler Property

Definition

Gets or sets a value that determines if HTTP method matching for Razor Pages handler methods will use fuzzy matching. Defaults to false.

public:
 property bool AllowMappingHeadRequestsToGetHandler { bool get(); void set(bool value); };
public bool AllowMappingHeadRequestsToGetHandler { get; set; }
member this.AllowMappingHeadRequestsToGetHandler : bool with get, set
Public Property AllowMappingHeadRequestsToGetHandler As Boolean

Property Value

Remarks

When enabled, Razor Pages handler methods will be more flexible in which HTTP methods will be accepted by GET and POST handler methods. This allows a GET handler methods to accept the HEAD HTTP methods in addition to GET. A more specific handler method can still be defined to accept HEAD, and the most specific handler will be invoked.

This setting reduces the number of handler methods that must be written to correctly respond to typical web traffic including requests from internet infrastructure such as web crawlers.

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_0 then this setting will have value false unless explicitly configured.

If the application's compatibility version is set to Version_2_1 or higher then this setting will have value true unless explicitly configured.

Applies to