I am using ASP.NET MVC 1.0. I have an ActionResult which receives a form post with a value from a drop down list. It then redirects to an ActionResult, passing the value as a parameter. Here are my 2 ActionResult methods:
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult FindPromo()
{
var promoId = Convert.ToInt32(Request.Form["ddlPromotion"]);
return RedirectToAction("GetPromo", new { id= promoId });
}
public ActionResult GetPromo(int id)
{
if (promoId > 0)
{
var model = GetModel(id);
if (model.Promo != null)
{
return View("Promo", GetModel(id));
}
}
return RedirectToAction("NotFound");
}
When I debug this, the value from the drop down list is pulled correctly from my form, but on the redirect, a different value from a previous request comes through as the promoId value on the GetPromo method. This happens even if I I totally close out of the page and reload it, almost as if it's cached somewhere. I know this is something simple, but I've never run across this before.
EDIT:
I changed the parameter names from promoId to id, and also updated my routing table. I've updated my code sample above, and here are my routes:
routes.MapRoute("GetPromo", "{controller}/GetPromo/{id}",
new { controller = "Promo", action = "GetPromo" });
routes.MapRoute("FindPromo", "{controller}/FindPromo/{id}",
new { controller = "Promo", action = "FindPromo" });
I'm still getting the same results with the parameters, however.