tags:

views:

69

answers:

2

I have two method signatures at the moment.

public ActionResult Edit(bool? failed)

[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Update(FormCollection collection)

In the Update method when the password update fails I want to return to the Edit action with failed == true. However using the line

return RedirectToAction("Edit", true);

doesn't seem to achieve this. (I do end up at the Edit Action but the bool value is null.) How else can I redirect to an action and still have the bool value hold?

Thanks

+3  A: 

You are close - try this:

return RedirectToAction("Edit", new { failed = true });
Kurt Schindler
+2  A: 

I'm afraid RedirectToAction isn't as simple as that... you need to pass the parameter as a route value dictionary. Try:

return RedirectToAction("Edit", new { failed = true }); 

See http://msdn.microsoft.com/en-us/library/system.web.mvc.controller.redirecttoaction.aspx

Steve Haigh