修改BUG:修改网页未找到时,Error页面重定向错误
This commit is contained in:
parent
23d72f4120
commit
83071c9874
|
@ -28,7 +28,8 @@ namespace Bootstrap.Admin.Controllers
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
public IActionResult Error(int id)
|
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();
|
return id == 404 ? View("NotFound") : View();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,8 @@ namespace Bootstrap.Client.Controllers
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
public IActionResult Error(int id)
|
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());
|
return Redirect(uriBuilder.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue