Can app.UseErrorHandler() access error details?

前端 未结 3 806
轻奢々
轻奢々 2021-01-02 11:33

In my MVC4 app I had a global.asax.cs override of Application_Error(object sender, EventArgs e) where I could extract the exception, statusCo

3条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-02 12:12

    From your configured error handling action, you could do something like:

    public IActionResult Error()
    {
        // 'Context' here is of type HttpContext
        var feature = Context.GetFeature();
        if(feature != null)
        {
            var exception = feature.Error;
        }
    ......
    .......
    

提交回复
热议问题