码迷,mamicode.com
首页 > 其他好文 > 详细

使用Redirect跳转

时间:2016-06-09 21:00:30      阅读:265      评论:0      收藏:0      [点我收藏+]

标签:

实现方法

[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跳转

标签:

原文地址:http://www.cnblogs.com/zkcloud/p/5572664.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!