我有连结

http://localhost:3163/PaymentOrder?AgentCode=&InvoiceNo=&AgentName=&FromDate=&fromDate=12%2F11%2F2013&FromDate=12%2F11%2F2013+9%3A08%3A01+SA&toDate=12%2F11%2F2013


单击“删除”按钮后,页面应重定向到“索引”

        return RedirectToAction("Index","PaymentOrder");


但我想保持链接与第一个相同,我不知道哪种方法,请帮助我。谢谢

我可以修复它,我将会话保存在

public ActionResult Index{
  Session["LastPage"] = Request.Url.ToString();
}


我之后

return Redirect(Session["LastPage"] as String);

最佳答案

您可以将查询字符串传递给RedirecToAction的第三个参数

return RedirectToAction("Index","PaymentOrder", new { fromDate = model.FromDate });


或也传递整个模型,其中包含与查询字符串相似的属性

return RedirectToAction("Index","PaymentOrder", new { paymentModel = model });

10-08 11:31