如何防止 IIS 使用 IIS 默认错误页面覆盖自定义错误页面?是否有 Response.TrySkipIisCustomErrors 等效于 asp.net 核心?在 ASP Net MVC 中,我使用下面的代码在没有自定义页面的情况下发送错误,但在 asp net core 中它不起作用。
try
{
// some code
}
catch (Exception ex)
{
Response.TrySkipIisCustomErrors = true;
Response.StatusCode = (int)HttpStatusCode.InternalServerError;
mensagem = ex.Message;
}
Run Code Online (Sandbox Code Playgroud) asp.net-core ×1