Skip to content

Define handlers for status codes with UseStatusCodePages #2589

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
aspnet-hello opened this issue Jan 2, 2018 · 4 comments
Closed

Define handlers for status codes with UseStatusCodePages #2589

aspnet-hello opened this issue Jan 2, 2018 · 4 comments
Labels
area-middleware Includes: URL rewrite, redirect, response cache/compression, session, and other general middlewares area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates enhancement This issue represents an ask for new feature or an enhancement to an existing one feature-diagnostics Diagnostic middleware and pages (except EF diagnostics)
Milestone

Comments

@aspnet-hello
Copy link

From @jchannon on Wednesday, April 12, 2017 4:17:48 AM

In Nancy you can implement a IStatusCodeHandler which has CanHandle and a Handle methods. CanHandle returns a boolean that says for this statuscode I can handle it and then in the Handle it writes a response.

In UseStatusCodePages it seems to be a global filter for status codes. How do I say only execute x when the statuscode is y. Only examples I have seen is to write a Controller method that has a switch statement on the statuscode and that is very ugly.

Is there a cleaner way of doing it? If not could we make it cleaner?

Copied from original issue: aspnet/Diagnostics#357

@aspnet-hello aspnet-hello added this to the Backlog milestone Jan 2, 2018
@aspnet-hello
Copy link
Author

From @Eilon on Tuesday, June 6, 2017 10:20:59 AM

Seems like an interesting idea, but no current plans to implement this.

@mkArtakMSFT
Copy link
Member

@Tratcher, is there any reason we don't provide a simple way to register a handler per status code?

@Tratcher
Copy link
Member

Tratcher commented Oct 8, 2018

Only the complexity of implementing it on our side. I'd be curious to see some proposals.

@mkArtakMSFT mkArtakMSFT added 1 - Ready enhancement This issue represents an ask for new feature or an enhancement to an existing one labels Oct 10, 2018
natemcmaster pushed a commit that referenced this issue Nov 15, 2018
…cifiedMinimumRate (#2589)

- Fix race condition in test code
- Addresses aspnet/KestrelHttpServer#2539
@Eilon Eilon added area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates feature-diagnostics Diagnostic middleware and pages (except EF diagnostics) and removed repo:Diagnostics labels Nov 26, 2018
@pranavkm pranavkm added the c label Aug 21, 2019
@mkArtakMSFT
Copy link
Member

Hi. Thanks for contacting us.
We're closing this issue as there was not much community interest in this ask for quite a while now.

@ghost ghost locked as resolved and limited conversation to collaborators Dec 4, 2019
@amcasey amcasey added the area-middleware Includes: URL rewrite, redirect, response cache/compression, session, and other general middlewares label Jun 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-middleware Includes: URL rewrite, redirect, response cache/compression, session, and other general middlewares area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates enhancement This issue represents an ask for new feature or an enhancement to an existing one feature-diagnostics Diagnostic middleware and pages (except EF diagnostics)
Projects
None yet
Development

No branches or pull requests

6 participants