How to pass List in Redirecttoaction

后端 未结 4 500
萌比男神i
萌比男神i 2020-12-01 23:36

I want to pass more then one parameter from RedirectToAction method

how can I pass?

My One Action Method

 [HttpPost, ActionN         


        
4条回答
  •  时光取名叫无心
    2020-12-02 00:16

    This is probably not even active anymore, but I'll leave how I did it here to maybe help someone else.

    I solved this using a simple Redirect instead of a RedirectToAction:

    List myList = myListofItems;
    var list = HttpUtility.ParseQueryString("");
    myList.ForEach(x => list.Add("parameterList", x.ToString()));
    return Redirect("/MyPath?" + list);
    

    Then, on your other method:

    public ActionResult Action(List parameterList){}
    

提交回复
热议问题