2016-06-14 45 views
1

我感兴趣的参考作用后 重定向和我希望它是类似于通用返回常规动作后法MVC中控制器

 ActionResult action = new DashboardController().Index(3); 
     return action; 

我想这样的代码

因为我使用POST 重定向到一个网页,我不能用这个

return RedirectToAction(actionName, controllerName); 

Example

 public ActionResult generic(string Controller,string Action) 
     { 
      Assembly asm = Assembly.GetAssembly(typeof(MvcApplication)); 

      var controlleractionlist = asm.GetTypes() 
        .Where(type => typeof(Controller).IsAssignableFrom(type)); 

      return typeof(typeof(controlleractionlist).GetProperty(Controller)) 
      .GetProperty(Action); 
      } 

链接可以帮助也许答案 Link 1 link 2

我提前为我的英语

回答

-3

道歉试试这个,如果它工作

ActionResult instance=new ControllerClass()Index(parameters); 
return instance; 
+0

我只是想只是通用的,我可以发送每一个不同的t控制器和不同的行动 –