一般的Window.Location.href会造成URL地址追加

较为好的写法为:

return Content(string.Format("<script type='text/javascript'>alert('请先维护实验前提条件!');window.location.href='{0}'</script>", Url.Action("OfflineLab", "OfflineLab", new { labType = Server.UrlEncode(topic), conditionDesc = unit })));

①要是有中文参数的话,需要加 Server.UrlEncode(中文参数)传递到控制器的action中;

②接收中文参数的话,则为  string   labType = Server.UrlDecode(labType);

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-10-17
  • 2021-06-03
  • 2022-01-17
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-07-06
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案