asp.net-mvc 如何在控制器操作中重定向到 aspx 页面
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12977047/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
how to redirect to aspx page in a controller action
提问by hazimdikenli
is it possible to redirect to an aspx page in an (asp.net-mvc3 )controller action? What should be the return type of the action (ActionResult?) and which redirect method should be called (RedirectToAction?).
是否可以在 (asp.net-mvc3 ) 控制器操作中重定向到 aspx 页面?操作的返回类型应该是什么(ActionResult?)以及应该调用哪个重定向方法(RedirectToAction?)。
BR,
BR,
回答by VJAI
You can redirect to anywhere from MVC action and you have to use RedirectResultfor that. RedirectResultis a type of ActionResult.
您可以从 MVC 操作重定向到任何地方,您必须为此使用RedirectResult它。RedirectResult是 的一种ActionResult。
For ex.
例如。
public RedirectResult RedirectToAspx()
{
return Redirect("/pages/index.aspx");
}
回答by ChunHao Tang
Yes, just like razor.
是的,就像剃须刀一样。
View:
看法:
test.aspx
Controller:
控制器:
public ActionResult test()
{
ViewBag.Message = "test。";
return View();
}

