Reputation: 1163
I'm working with ASP.NET MVC 4 and I need to return a status code of 420, which is not found among the HttpStatusCode enumeration values.
Usually it's simple, you do something like:
return Request.CreateResponse(HttpStatusCode.InternalServerError, error);
But what do I do when I don't have an enumeration value for the status code I want?
Upvotes: 1
Views: 1147
Reputation: 1163
Figured it out. All you have to do is cast the integer status code to HttpStatusCode:
return Request.CreateResponse((HttpStatusCode) 420, error);
Upvotes: 2