return new RedirectResult() vs return Redirect()

前端 未结 3 1484
灰色年华
灰色年华 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:52

    They do the same thing. The Redirect method of the controller creates a new RedirectResult. If you instantiate the RedirectResult you also have the ability to add a parameter which determines whether the redirect is permanent (or not).

提交回复
热议问题