return new RedirectResult() vs return Redirect()

前端 未结 3 1488
灰色年华
灰色年华 2021-02-07 02:17

What is the difference between the following two controller ActionResult return statements:

return new RedirectResult(\"http://www.google.com\", false);
<         


        
3条回答
  •  一生所求
    2021-02-07 02:41

    this.Redirect(string url) - It will internally create new object of RedirectResult class and do temporary redirection.

    new RedirectResult(string url, bool permanent) - It will redirect but gives you an option to redirect permanently or temporary.

提交回复
热议问题