The following Exception Filter redirects exceptions to my specific error page:
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, AllowMultiple = false)] public class FrontofficeControllerExceptionFilterAttribute : ExceptionFilterAttribute { protected readonly ILogger<FrontofficeController> _logger; protected readonly IHostingEnvironment _hostingEnvironment; protected readonly IModelMetadataProvider _modelMetadataProvider; public FrontofficeControllerExceptionFilterAttribute(ILogger<FrontofficeController> logger, IHostingEnvironment hostingEnvironment, IModelMetadataProvider modelMetadataProvider) { _logger = logger; _hostingEnvironment = hostingEnvironment; _modelMetadataProvider = modelMetadataProvider; } public override void OnException(ExceptionContext context) { if (context.ExceptionHandled) return; Exception ex = context.Exception; var result = new ViewResult { ViewName = "ApplicationError" }; context.ExceptionHandled = true; // mark exception as handled context.Result = result; } }
After migrating my web app to asp.net core 1.1 the result is a blank page: the body of the response is empty and Content-Length is zero. This is the response received on the client
HTTP/1.1 200 OK Server: Kestrel X-SourceFiles: =?UTF-8?B?QzpcUHJvamVjdHNcaW50ZXJhaC52aXN1YWxzdHVkaW8uY29tXEludmVudGFyaW9cTWFpblxTb3VyY2VcRnJvbnRvZmZpY2Vcc3JjXEZyb250b2ZmaWNl?= X-Powered-By: ASP.NET Date: Wed, 30 Nov 2016 14:49:53 GMT Content-Length: 0
have anyone experienced a similar problem and why? thankyou for any comment