diff --git a/Bootstrap.Admin/Bootstrap.Admin.csproj b/Bootstrap.Admin/Bootstrap.Admin.csproj
index b81e479b..62b32f2a 100644
--- a/Bootstrap.Admin/Bootstrap.Admin.csproj
+++ b/Bootstrap.Admin/Bootstrap.Admin.csproj
@@ -9,6 +9,7 @@
+
diff --git a/Bootstrap.Admin/Controllers/HomeController.cs b/Bootstrap.Admin/Controllers/HomeController.cs
index e1981c1a..97ec68fd 100644
--- a/Bootstrap.Admin/Controllers/HomeController.cs
+++ b/Bootstrap.Admin/Controllers/HomeController.cs
@@ -22,11 +22,12 @@ namespace Bootstrap.Admin.Controllers
///
///
///
+ ///
///
[AllowAnonymous]
- public ActionResult Error()
+ public IActionResult Error(int id)
{
- return View();
+ return id == 404 ? View("NotFound") : View();
}
}
}
\ No newline at end of file
diff --git a/Bootstrap.Admin/Startup.cs b/Bootstrap.Admin/Startup.cs
index a5576524..a8e45d78 100644
--- a/Bootstrap.Admin/Startup.cs
+++ b/Bootstrap.Admin/Startup.cs
@@ -62,6 +62,7 @@ namespace Bootstrap.Admin
{
app.UseExceptionHandler("/Home/Error");
}
+ app.UseStatusCodePagesWithReExecute("/Home/Error/{0}");
app.UseCors(builder => builder.WithOrigins(Configuration["AllowOrigins"].Split(',', StringSplitOptions.RemoveEmptyEntries)).AllowAnyHeader().AllowAnyMethod().AllowCredentials());
app.UseStaticFiles();
app.UseAuthentication();
diff --git a/Bootstrap.Admin/Views/Home/NotFound.cshtml b/Bootstrap.Admin/Views/Home/NotFound.cshtml
new file mode 100644
index 00000000..444a0374
--- /dev/null
+++ b/Bootstrap.Admin/Views/Home/NotFound.cshtml
@@ -0,0 +1,17 @@
+@{
+ ViewBag.Title = "资源未找到";
+ Layout = "~/Views/Shared/_Root.cshtml";
+}
+@section css {
+
+}
+@section Javascript {
+
+}
+
+
+ 请求资源未找到
+ 相关错误信息已经记录到日志中,请登录服务器查看
+
+ 返回首页
+
diff --git a/Bootstrap.Admin/wwwroot/images/404_icon.png b/Bootstrap.Admin/wwwroot/images/404_icon.png
new file mode 100644
index 00000000..e4576d2c
Binary files /dev/null and b/Bootstrap.Admin/wwwroot/images/404_icon.png differ