MiaoWin
MiaoWin

Reputation: 475

RedirectToAction to action in another controller not working

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

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

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.

Thanks.

Upvotes: 5

Views: 1723

Answers (1)

Stafford Williams
Stafford Williams

Reputation: 9806

Try this:

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

Upvotes: 6

Related Questions