RedirectToAction到另一个控制器动作不灵 [英] RedirectToAction to action in another controller not working

查看:257
本文介绍了RedirectToAction到另一个控制器动作不灵的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我MVC3 POST方法的ActionResult,我有code的一部分是这样的:

In my mvc3 POST ActionResult method, I have a portion of code like this:

if (button == "Save as Pdf")
{                
  RedirectToAction("getPdf", "Pdf", resultObtained);
}

当用户在点击按钮,这将用户重定向到getPdf行动PdfController同时传递对象resultObtained以及获得通过浏览器,但该RedirectToAction本身工作不下载的PDF文件。

when the user clicked on the button, it redirect the user to getPdf action in PdfController while passing the object resultObtained as well to get the PDF file downloaded via browser but the RedirectToAction itself is not working.

感谢。

推荐答案

试试这个:

if (button == "Save as Pdf")
{                
  return RedirectToAction("getPdf", "Pdf", resultObtained);
}

这篇关于RedirectToAction到另一个控制器动作不灵的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆