我需要从控制器A调用控制器B动作FileUploadMsgView,并需要为其传递参数。
Code---its not going to the controller B's FileUploadMsgView(). In ControllerA private void Test() { try {//some codes here ViewBag.FileUploadMsg = "File uploaded successfully."; ViewBag.FileUploadFlag = "2"; RedirectToAction("B", "FileUploadMsgView", new { FileUploadMsg = "File uploaded successfully" }); } In ControllerB receiving part public ActionResult FileUploadMsgView(string FileUploadMsg) { return View(); }
控制器只是类-新的类并像调用其他任何类成员一样调用action方法:
var result = new ControllerB().FileUploadMsgView("some string");