Asp.net core model doesn't bind from form

后端 未结 10 901
没有蜡笔的小新
没有蜡笔的小新 2021-02-02 13:54

I catch post request from 3rd-side static page (generated by Adobe Muse) and handle it with MVC action.

10条回答
  •  心在旅途
    2021-02-02 14:16

    I'm not sure it is same case, but I had same problem and nothing really looks to work for me.
    The problem in my case was that I had a property called Model in my view model class

    public string Model { get; set; }
    

    When I renamed the property to ModelName everything was working fine again, even without FromForm attribute.

    Looks like some special property names could be a bit of a problem for asp.net mvc model binding.

    So, my advice is to check your model properties and maybe try renaming them one by one in order to check if the problem is there.

    Hope this helps.

提交回复
热议问题