ASP.NET Core Pitfalls - Null Models in Post Requests

added by DotNetKicks
3/25/2021 4:32:03 PM

542 Views

Sometimes, when AJAX posting to a controller, you may get a null model. Why? Let's exclude the obvious - you didn't send a null payload. The most typical reason is, the serializer could not deserialize the payload into the target type, and it just silently sets it to null, but no exception is thrown.


0 comments