In my MVC4 app I had a global.asax.cs override of Application_Error(object sender, EventArgs e)
where I could extract the exception
, statusCode
and requestedUrl
(for handling 404). That would get sent to my controller and the error page would be different for 404s vs 5xx (these get a stack trace). I don't see how to get this same info to my Error action using UseErrorHandler()
. Am I using the right approach in ASP.NET Core?
相关问题
- Can I use MvcJsonOptions configured during Startup
- Singleton with AsyncLocal vs Scope Service
- gRPC client do not dispose Channel
- Unable to resolve service for type 'Microsoft.
- Which encryption algorithm do we use in Asp.net 5
相关文章
- EF Core 'another instance is already being tra
- Re-target .NET Core to net471, net 472
- How to replace Middleware in integration tests pro
- Why CsvHelper not reading from MemoryStream?
- How to define function that returns html in asp.ne
- Bad Request - Invalid Hostname when accessing loca
- Should I use xUnitPublisher or xUnitBuilder after
- How to log ASP.NET Core input JSON serialization e
Aug. 02th 2016 - Update for 1.0.0
Startup.cs
HomeController.cs
project.json
From your configured error handling action, you could do something like:
In Beta8, agua from mars' answer is a little different.
Instead of:
Use:
This also requires a reference to Microsoft.AspNet.Http.Features, and the following line in Configure() in Startup.cs: