Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Has the generic version of HttpResponseMessage been removed from the ASP.NET WebApi?

I just finished installing VS 2012 RC and have started working with the ASP.NET Web API. I am basing my work on some tutorials from PluralSight which I've been using as reference.

In every tutorial and article which I've used, I notice that they are using a generic version of HttpResponseMessage in the return type of Action, but to my surprise this object was not available to me while coding. I thought perhaps the issue was just an incorrect namespace reference, but that does not seem to be the case.

Can anyone point me toward some source code or reference material on how to utilize the generic HttpResponseMessage object that PluralSight uses in their videos?

like image 726
Parv Sharma Avatar asked Jul 11 '12 07:07

Parv Sharma


2 Answers

Searching for the answer i found this article and it states that the generic version has been removed
so now just mention the return type to be of type HttpresponseMessage and when actually returning the response use
Request.CreateResponse<T>(params);

like image 86
Parv Sharma Avatar answered Nov 02 '22 17:11

Parv Sharma


yes i was also looking through the same thing.. the generic version of the HttpResponseMessage was remove recently.. because it was not type safe

like image 45
crypt Avatar answered Nov 02 '22 17:11

crypt