Skip to content

FromQueryOrFormAttribute Class

An attribute that specifies binding from either the query string or the form data.

C#
public class FromQueryOrFormAttribute : Microsoft.AspNetCore.Mvc.BindAttribute, Microsoft.AspNetCore.Mvc.ModelBinding.IBindingSourceMetadata

Inheritance System.ObjectSystem.AttributeMicrosoft.AspNetCore.Mvc.BindAttribute → FromQueryOrFormAttribute

Implements Microsoft.AspNetCore.Mvc.ModelBinding.IBindingSourceMetadata

Remarks

This attribute is useful in scenarios where a value can be provided either through the query string or form data. It implements Microsoft.AspNetCore.Mvc.ModelBinding.IBindingSourceMetadata and extends Microsoft.AspNetCore.Mvc.BindAttribute.

Constructors

FromQueryOrFormAttribute() Constructor

Initializes a new instance of the FromQueryOrFormAttribute class.

C#
public FromQueryOrFormAttribute();

Remarks

By default, the prefix is set to an empty string, indicating no specific prefix for the bound properties.

Properties

FromQueryOrFormAttribute.BindingSource Property

Gets the binding source for this attribute, combining both Query and Form sources.

C#
public Microsoft.AspNetCore.Mvc.ModelBinding.BindingSource BindingSource { get; }

Implements BindingSource

Property Value

Microsoft.AspNetCore.Mvc.ModelBinding.BindingSource

Remarks

Specifies that the binding source is a composite of both Query and Form sources.