c# - TempData is empty after RedirectToAction in catch block. What could be the reason? -


I've been using TempData for a long time and I'm facing a weird problem for me. The scenario is: Make

  [http post] Make public analytical (ProductContodelNewsprint) {// and try to upload the product to DB / External site. Try {UploadProductToEbay (newProduct); } Hold {TempData ["error"] = "error"; Return Redirect Action ("Edit", newProduct.Id); } ...} [HTPGet] edit public action result (id) {var error = tempdata ["error"]; // Temporary data collection is empty at this point and it has no idea why ...}   

The upload fails and returns the redirection tie ("Edit" , New product ID); The execution of the line is "TempData [" error "] ="

UPDATE: when I use

 , error " ; RedirectToAction (...);   

Block out Hold Everything is fine, the temporary data value is moved to the edit operation.

It seems that the problem is return redirect action ("edit", newProduct.Id); is in the statement.
Try this statement instead of Return Redirect Action ("Edit", New {ID = NewProject.Id}); Type the object of the root parameter and you integer .

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -