Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Umbraco 7 - Redirecting to another page from a controller

I am working with Umbraco 7 and with Umbraco for the first time. I am trying to redirect to another page from a custom controller that implements RenderMvcController.

I have tried ASP.NET MVC's return RedirectToAction("Index", "Home");, but this does not seem to work.

Does anyone have an idea how to achieve this?

like image 958
Prabu Avatar asked Jan 04 '14 11:01

Prabu


2 Answers

See below code, it will redirect to retrunUrl page.

 return this.Redirect(returnUrl);
like image 77
Lin Avatar answered Nov 08 '22 18:11

Lin


Another way is using the RedirectResult class, where you can control if it should be a temporary (302) or a permanent (301) redirect:

return new RedirectResult("http://stackoverflow.com/", false); // 302
like image 1
Saustrup Avatar answered Nov 08 '22 17:11

Saustrup