views:

7

answers:

0

I am using [PassparametersDuringRedirectAttribute] with an action in the controller. The action takes an id as parameter. After a redirect to another action that also takes an id I found a problem. The problem is that if I called the url for this action with the id in the url the action will disregard the url id and retrieve the id from the session, which is the one sent from a redirect. Please can some one explain what is going on and how can I solve this problem.

 [PassparametersDuringRedirectAttribute] 
     public ActionResult Test(int id) {
       this.RedirectToAction(x => x.view(20))
    }

 [PassparametersDuringRedirectAttribute] 
public ActionResult View(int id) {
return View();
}

In order to pass the id I need to add the attribute on top of the Test method but this will cause a problem. The problem if I call my action Test from the url:localhost/controller/Test/10 the id in the Test will be 20 and not 10.

Thank you