現在、ASP.NET Coreを使用しています。処理されない例外のデフォルトページ404を設定するにはどうすればいいですか?NotFound()
?NotFound()または未処理の例外を404ページで返します。
IActionResult Foo()
{
throw new Exception("Message!");
}
IActionResult Bar()
{
return NotFound("Message!");
}
私はエラーページを設定するIApplicationBuilder.UseExceptionHandler
方法があると思いますが、私はそれを設定する方法がわかりません。
こちらをご確認くださいhttps://stackoverflow.com/questions/37690114/asp-net-core-how-to-return-a-specific -status-code-and-no-contents-from-control –
@CarlosFerreiraこれは別の質問です。 – MiP