最佳答案
我需要从 Controller A 调用控制器 B 操作 FileUploadMsgView,并需要为它传递一个参数。
它不会进入控制器 B 的 FileUploadMsgView()
。
密码是这样的:
控制员 A:
private void Test()
{
try
{ //some codes here
ViewBag.FileUploadMsg = "File uploaded successfully.";
ViewBag.FileUploadFlag = "2";
RedirectToAction("B", "FileUploadMsgView", new { FileUploadMsg = "File uploaded successfully" });
}
}
控制员 B (接收部分) :
public ActionResult FileUploadMsgView(string FileUploadMsg)
{
return View();
}