Geeks With Blogs

News ASP.net Forms Justin Hoffman
Justin Hoffman February 2012 Entries
Custom MediaType Formatters in MVC 4 Web Api Error: 'Headers.ContentType' must be set before 'ObjectContent' can serialize its content
After upgrading to the MVC 4 Web Api a problem came up where the custom MediaTypeFormatters we were using were no longer functioning.You must now override, CanWriteType and CanReadType in your customer formatter, or it will return false by default. 'Headers.ContentType' must be set before 'ObjectContent' can serialize its content"vIdeally, some checks would be made here to determine if you truly can read or write the type..but for this example, return true.Throwing the following error: /// <summary> ......

Posted On Tuesday, February 28, 2012 3:53 PM

Copyright © Justin Hoffman | Powered by: GeeksWithBlogs.net