将多个参数从window.location传递给action mvc

时间:2014-03-09 04:08:45

标签: c# javascript jquery asp.net-mvc

我正在传递多个参数。但是id不会进入webbrowser url.And错误即将“传递null参数”.wat是问题吗?

  window.location.href = "http://localhost:8088/Home/PostToFacebook/?msg=" + msg + "&itemid=" + itemid;

我的行动

public ActionResult PostToFacebook(string msg, int itemid) { return RedirectToAction("Item", new { id = itemid }); }

1 个答案:

答案 0 :(得分:0)

/之前删除正斜杠?msg

应该是

  window.location.href = "http://localhost:8088/Home/PostToFacebook?msg

而不是

  window.location.href = "http://localhost:8088/Home/PostToFacebook/?msg