You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.
When submit the form and if the form data has an item with key Model, Model binding is failing.
For example, let's say i have a view model like this and I use that class as the param of my http post action method.
public class ModelBinderTestViewModel
{
public string Name { set; get; }
public string Model { set; get; }
}
and if i am sending form data like this from my form Name=Shyju
Model binding works, but when i send
Name:Shyju
Model:Honda
Model binding does not work now.
Here is the link to a minimal sample repo where you can see this issue . Just run the sample app and submit the form and you will see the results in the next view.
Is this a know issue ? If yes, Is there some sort of documentation to advise users to not use Model as a property name.
The text was updated successfully, but these errors were encountered:
The documentation, especially the How Model Binding Works sub-section, does describe how request names and values are bound to c# properties. However, the implications of the naming details are not thoroughly spelled out. We thus see a fair number of issues like this one.
The workaround could also be called out in the API Reference e.g. the [ModelBinder] documentation. Right now, the [[ModelBinder(Name = "...")] details] are only boilerplate.
When submit the form and if the form data has an item with key
Model
, Model binding is failing.For example, let's say i have a view model like this and I use that class as the param of my http post action method.
and if i am sending form data like this from my form
Name=Shyju
Model binding works, but when i send
Model binding does not work now.
Here is the link to a minimal sample repo where you can see this issue . Just run the sample app and submit the form and you will see the results in the next view.
Is this a know issue ? If yes, Is there some sort of documentation to advise users to not use
Model
as a property name.The text was updated successfully, but these errors were encountered: