From 83071c98741743e1a0fa38d50bfee19bbe81c0f9 Mon Sep 17 00:00:00 2001 From: Argo-MacBookPro Date: Fri, 12 Oct 2018 18:52:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9BUG=EF=BC=9A=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E7=BD=91=E9=A1=B5=E6=9C=AA=E6=89=BE=E5=88=B0=E6=97=B6?= =?UTF-8?q?=EF=BC=8CError=E9=A1=B5=E9=9D=A2=E9=87=8D=E5=AE=9A=E5=90=91?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Bootstrap.Admin/Controllers/HomeController.cs | 3 ++- Bootstrap.Client/Controllers/HomeController.cs | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Bootstrap.Admin/Controllers/HomeController.cs b/Bootstrap.Admin/Controllers/HomeController.cs index c1e17c8f..c6f095d6 100644 --- a/Bootstrap.Admin/Controllers/HomeController.cs +++ b/Bootstrap.Admin/Controllers/HomeController.cs @@ -28,7 +28,8 @@ namespace Bootstrap.Admin.Controllers [AllowAnonymous] public IActionResult Error(int id) { - ViewBag.ReturnUrl = Request.Query[CookieAuthenticationDefaults.ReturnUrlParameter].ToString() ?? Url.Content("~/Home/Index"); + var returnUrl = Request.Query[CookieAuthenticationDefaults.ReturnUrlParameter].ToString(); + ViewBag.ReturnUrl = string.IsNullOrEmpty(returnUrl) ? Url.Content("~/Home/Index") : returnUrl; return id == 404 ? View("NotFound") : View(); } } diff --git a/Bootstrap.Client/Controllers/HomeController.cs b/Bootstrap.Client/Controllers/HomeController.cs index 8a209605..59b9ac89 100644 --- a/Bootstrap.Client/Controllers/HomeController.cs +++ b/Bootstrap.Client/Controllers/HomeController.cs @@ -28,7 +28,8 @@ namespace Bootstrap.Client.Controllers [AllowAnonymous] public IActionResult Error(int id) { - var uriBuilder = new UriBuilder(ConfigurationManager.AppSettings["AuthHost"]) { Path = Request.Path, Query = QueryString.Create(CookieAuthenticationDefaults.ReturnUrlParameter, $"{Request.Scheme}://{Request.Host}{Request.PathBase}").ToString() }; + var uriBuilder = new UriBuilder(ConfigurationManager.AppSettings["AuthHost"]) { Query = QueryString.Create(CookieAuthenticationDefaults.ReturnUrlParameter, $"{Request.Scheme}://{Request.Host}{Request.PathBase}").ToString() }; + uriBuilder.Path += Request.Path; return Redirect(uriBuilder.ToString()); } }