Topics: ASP.NET Web API
Jun 12, 2012 at 4:35 AM


 i have noticed that httprequestmessage<> , httpresponsemessage<> are not shipped with MVC 4 RC which were there as part of MVC4 beta.

i am trying to implement the action filter for model validation & got struck @ creating a response object & assign it to response message

Unable to build this piece of code :


 context.Response = context.Request.CreateResponse<JObject>(HttpStatusCode.BadRequest, errors);


ERROR is :

Error    2    'System.Net.Http.HttpRequestMessage' has no applicable method named 'CreateResponse' but appears to have an extension method by that name. Extension methods cannot be dynamically dispatched. Consider casting the dynamic arguments or calling the extension method without the extension method syntax.    ....\Projects\FWM\FWM\Filters\ValidationActionFilter.cs    32    36    FWM

Jun 12, 2012 at 1:40 PM
Don't use variables of type "dynamic" when trying to use extension methods.