简体   繁体   中英

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?

看下面的代码,它将重定向到retrunUrl页面。

 return this.Redirect(returnUrl);

另一种方法是使用RedirectResult类,您可以在其中控制它应该是临时(302)还是永久(301)重定向:

return new RedirectResult("http://stackoverflow.com/", false); // 302

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM