I'm using asp.net web-api and trying to catch 2 situations:
- an undefined Uri parameter is passed
- an invalid value for the Uri parameter is passed
Parameters and value bind successfully, but when either the name or the value are invalid, no exception occurs and a null is passed.
More details:
ModelState.IsValid
is always true
I have cleared all formatters
Using GlobalConfiguration.Configuration.Formatters.Clear();
and then adding my inherited XmlMediaTypeFormatter which sets XmlSerializer = true
Also I'm using a schema generated classes (xsd tool) for the complex types
This is the controller method signature:
public Messages GetMessages(int? startId = null, int? endId = null, DateTime? startDate = null, DateTime? endDate = null, int? messageType = null, string clientId = "", bool isCommentsIncluded = false)
Any ideas?