MvcOptions.AllowBindingHeaderValuesToNonStringModelTypes Property


Gets or sets a value that determines if HeaderModelBinder should bind to types other than String or a collection of String. If set to true, HeaderModelBinder would bind to simple types (like String, Int32, Enum, Boolean etc.) or a collection of simple types. The default value of the property is false.

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

Property Value



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 value of the 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 the value false unless explicitly configured.

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

Applies to