RedirectToAction to action in another controller does not work

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

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

when the user clicks the button, he redirects the user to the getPdf action in the PdfController when passing the resultObtained object as well to get the PDF file downloaded via the browser, but RedirectToAction itself does not work.

Thanks.

+4
source share
1 answer

Try the following:

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

Source: https://habr.com/ru/post/1394108/


All Articles