Skip to content
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.

Bring back HttpNotFound(string statusDescription) #842

Closed
javiercn opened this issue Jul 22, 2014 · 5 comments
Closed

Bring back HttpNotFound(string statusDescription) #842

javiercn opened this issue Jul 22, 2014 · 5 comments

Comments

@javiercn
Copy link
Member

In MVC there is an explicit overload for HttpNotFound on controller that takes a string with the status description. That ends up generating an error page that displays the status description to the user.

Currently we don't have that overload. We should consider bringing it back as:

  1. It makes it easier to legacy applications into vNext as it improves back compat.
  2. It makes it easier (even possible in some cases) to troubleshot you application (For example, how do you troubleshot a 404 when your service is behind a non transparent proxy).
  3. It provides a very basic way of returning an error that can be displayed on the browser, with little chance for failure except for a closed connection or similar failure.
  4. It more accurately aligns with the HTTP protocol that says the following about 4xx results: The 4xx class of status code is intended for cases in which the client seems to have erred. Except when responding to a HEAD request, the server SHOULD include an entity containing an explanation of the error situation, and whether it is a temporary or permanent condition. These status codes are applicable to any request method. User agents SHOULD display any included entity to the user.
@javiercn javiercn added the bug label Jul 22, 2014
@danroth27 danroth27 added this to the 6.0.0-rc1 milestone Oct 8, 2014
@yishaigalatzer
Copy link
Contributor

I suggest we just make NotFound(object) overload available on Controller. It will return ObjectResult with the status code. We can also just fork inside the method of the object is null to just return HttpNotFound

@yishaigalatzer yishaigalatzer modified the milestones: 6.0.0-rc1, 6.0.0-beta3 Jan 14, 2015
@yishaigalatzer
Copy link
Contributor

Create an NotFoundObjectResult similar to BadRequestObjectResult and an overload in controller.cs. @rynowak is there a reason we didn't include this as part of the last cleanup of action results?

@rynowak
Copy link
Member

rynowak commented Feb 6, 2015

We didn't do the original bug this because there's no support for statusdescription in HttpContext.

It sounds like this issue is more about not-found-with-context, which wasn't on our radar for the previous cleanup.

@yishaigalatzer
Copy link
Contributor

StatusDescription is not coming back I guess. So this is just to add an override that takes an object

@ajaybhargavb
Copy link
Contributor

dc49a2c

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants