Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 705
MiaoWin Avatar asked Feb 01 '12 03:02

MiaoWin


1 Answers

Try this:

if (button == "Save as Pdf")
{                
  return RedirectToAction("getPdf", "Pdf", resultObtained);
}
like image 133
Stafford Williams Avatar answered Oct 16 '22 03:10

Stafford Williams