IAM具有控制器等,低于该另一控制器/动作是在路由表重定向到在路由未注册
public class InternalController : Controller
{
/*this controller is not registered in routes table*/
public ActionResult Foo()
{
return Content("Text from foo");
}
}
未注册从我想调用哪个被登记在路由表另一控制器/前一个控制器的重定向动作,一个未在路由表中注册的动作。
public class AjaxController : Controller
{
/*this controller is registered in routes table*/
public ActionResult Foo()
{
/*FROM HERE HOW DO I RETURN CONTENTS OF
controller=InternalController, action = Foo
*/
/*
i tried below piece of code but that doesnt seem to work
*/
return RedirectToAction("Foo", "InternalController ");
}
}
定义的路由(只有一个项目加)
public void RegisterRoutes(RouteCollection routes)
{
routes.MapRoute("Ajax","ajax/{action}",new {
controller="Ajax",
action="Index"
});
}
*未在路线中注册的控制器是什么* *?这对我来说没有任何意义。 –
如果你的类是'InternalController',那么你应该通过'RedirectToAction(“Foo”,“Internal”)''重定向到“Internal”控制器(即不是“InternalController”)。 –
@darin“未在路线中注册的控制器”:表示我没有在路线表中注册该控制器。 –