RedirectToAction with parameter

后端 未结 14 1796
傲寒
傲寒 2020-11-22 08:56

I have an action I call from an anchor thusly, Site/Controller/Action/ID where ID is an int.

Later on I need to redirect to th

14条回答
  •  一生所求
    2020-11-22 09:29

    I had this issue as well, and quite a nice way to do it if you are within the same controller is to use named parameters:

    return RedirectToAction(actionName: "Action", routeValues: new { id = 99 });
    

提交回复
热议问题