[英]Umbraco 7 - Redirecting to another page from a controller
I am working with Umbraco 7 and with Umbraco for the first time. 我第一次与Umbraco 7和Umbraco合作。 I am trying to redirect to another page from a custom controller that implements RenderMvcController.
我试图从实现RenderMvcController的自定义控制器重定向到另一个页面。
I have tried ASP.NET MVC's return RedirectToAction("Index", "Home");
我试过ASP.NET MVC的
return RedirectToAction("Index", "Home");
, but this does not seem to work. ,但这似乎不起作用。
Does anyone have an idea how to achieve this? 有谁知道如何实现这一目标?
看下面的代码,它将重定向到retrunUrl
页面。
return this.Redirect(returnUrl);
另一种方法是使用RedirectResult类,您可以在其中控制它应该是临时(302)还是永久(301)重定向:
return new RedirectResult("http://stackoverflow.com/", false); // 302
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.