Define handlers for status codes with UseStatusCodePages #2589
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
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 isy
. 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
The text was updated successfully, but these errors were encountered: