diff --git a/Bootstrap.Admin/Controllers/HomeController.cs b/Bootstrap.Admin/Controllers/HomeController.cs
index c6f095d6..116d2f79 100644
--- a/Bootstrap.Admin/Controllers/HomeController.cs
+++ b/Bootstrap.Admin/Controllers/HomeController.cs
@@ -20,6 +20,7 @@ namespace Bootstrap.Admin.Controllers
var url = DictHelper.RetrieveHomeUrl();
return url.Equals("~/Home/Index", System.StringComparison.OrdinalIgnoreCase) ? (IActionResult)View(new HeaderBarModel(User.Identity)) : Redirect(url);
}
+
///
///
///
@@ -29,8 +30,21 @@ namespace Bootstrap.Admin.Controllers
public IActionResult Error(int id)
{
var returnUrl = Request.Query[CookieAuthenticationDefaults.ReturnUrlParameter].ToString();
- ViewBag.ReturnUrl = string.IsNullOrEmpty(returnUrl) ? Url.Content("~/Home/Index") : returnUrl;
- return id == 404 ? View("NotFound") : View();
+ var model = new ErrorModel() { ReturnUrl = string.IsNullOrEmpty(returnUrl) ? Url.Content("~/Home/Index") : returnUrl };
+ model.Title = "服务器内部错误";
+ model.Content = "服务器内部错误";
+ model.Image = "error_icon.png";
+ if (id == 0)
+ {
+ model.Content = "未处理服务器内部错误";
+ }
+ else if (id == 404)
+ {
+ model.Title = "资源未找到";
+ model.Content = "请求资源未找到";
+ model.Image = "404_icon.png";
+ }
+ return View(model);
}
}
}
\ No newline at end of file
diff --git a/Bootstrap.Admin/Models/ErrorModel.cs b/Bootstrap.Admin/Models/ErrorModel.cs
new file mode 100644
index 00000000..c2ea8779
--- /dev/null
+++ b/Bootstrap.Admin/Models/ErrorModel.cs
@@ -0,0 +1,28 @@
+namespace Bootstrap.Admin.Models
+{
+ ///
+ ///
+ ///
+ public class ErrorModel
+ {
+ ///
+ ///
+ ///
+ public string Title { get; set; }
+
+ ///
+ ///
+ ///
+ public string Content { get; set; }
+
+ ///
+ ///
+ ///
+ public string Image { get; set; }
+
+ ///
+ ///
+ ///
+ public string ReturnUrl { get; set; }
+ }
+}
diff --git a/Bootstrap.Admin/Startup.cs b/Bootstrap.Admin/Startup.cs
index 500e0d08..b69ad17c 100644
--- a/Bootstrap.Admin/Startup.cs
+++ b/Bootstrap.Admin/Startup.cs
@@ -1,6 +1,5 @@
using Bootstrap.DataAccess;
using Bootstrap.Security.Filter;
-using Longbow.Logging;
using Longbow.Web;
using Longbow.Web.SignalR;
using Microsoft.AspNetCore.Authentication;
diff --git a/Bootstrap.Admin/Views/Home/Error.cshtml b/Bootstrap.Admin/Views/Home/Error.cshtml
index c211fd52..47646220 100644
--- a/Bootstrap.Admin/Views/Home/Error.cshtml
+++ b/Bootstrap.Admin/Views/Home/Error.cshtml
@@ -1,5 +1,6 @@
-@{
- ViewBag.Title = "服务器内部错误";
+@model ErrorModel
+@{
+ ViewBag.Title = Model.Title;
Layout = "_Layout";
}
@section css {
@@ -9,9 +10,9 @@
}
-
- 服务器内部错误
+
+ @Model.Content
相关错误信息已经记录到日志中,请登录服务器查看
- 返回首页
+ 返回首页
\ No newline at end of file
diff --git a/Bootstrap.Admin/Views/Home/NotFound.cshtml b/Bootstrap.Admin/Views/Home/NotFound.cshtml
deleted file mode 100644
index 2cf5c078..00000000
--- a/Bootstrap.Admin/Views/Home/NotFound.cshtml
+++ /dev/null
@@ -1,17 +0,0 @@
-@{
- ViewBag.Title = "资源未找到";
- Layout = "_Layout";
-}
-@section css {
-
-}
-@section javascript {
-
-}
-
-
- 请求资源未找到
- 相关错误信息已经记录到日志中,请登录服务器查看
-
- 返回首页
-
\ No newline at end of file