RedirectToAction with parameter

后端 未结 14 1563
傲寒
傲寒 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:50

    You can pass the id as part of the routeValues parameter of the RedirectToAction() method.

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

    This will cause a redirect to Site/Controller/Action/99. No need for temp or any kind of view data.

提交回复
热议问题