实现方法

[HttpGet("/Redirect")]
public IActionResult Redirect(string url, string title = null, bool sucess = true) {
    ViewRedirect model = new ViewRedirect();
    model.Url = url.IsNullOrEmpty() ? "/Index" : url;
   
    model.IsSucess = sucess;
    if (model.IsSucess) {
        model.Title = title.IsNullOrEmpty() ? "操作成功" : title;
    }else {
        model.Title = title.IsNullOrEmpty() ? "操作失败" : title;
    }
    return View(model);
}

 示例:

  url = $@"/Redirect?url={url}&title=会员注册成功";
  return Redirect(url);

 显示效果

使用Redirect跳转

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-12-14
  • 2021-09-26
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-06-07
  • 2021-06-24
  • 2021-05-30
  • 2022-02-13
相关资源
相似解决方案