一般的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);

转载于:https://www.cnblogs.com/yisheng/archive/2012/10/16/2726801.html

MVC 中用JS跳转窗体Window.Location.href相关推荐

  1. window location href跳转无效

    问题情况 JS中设置window.location.href跳转无效 原因是 a标签的href跳转会执行在window.location.href设置的跳转之前: 如果是表单form的话  也会先执行 ...

  2. window location href is not a function错误解决

    js报错:window.location.href is not a function是由于写法问题以及浏览器不兼容导致的,具体解决方法如下: 错误js写法: window.location.href ...

  3. 关于js中window.location.href、location.href 等如何跳转

    关于js中"window.location.href"."location.href"."parent.location.href".&qu ...

  4. Window.location.href命令在JS中跳转无效或自动忽略

    最近在做一个跳转本页面后提示信息window.location.href只能跳转一次,之后就自动忽略了.在下面加事件返回值即可跳转成功,注意:若在form提交函数中,则不会提交表单:若在超链接标签中, ...

  5. js如何获取window.location.href跳转后查询字符串的值?

    $("#worked_count").parent().attr("onClick","window.location.href='view/warn ...

  6. 关于js中window.location.href,location.href,parent.location.href,top.location.href的使用方法

    关于js中"window.location.href"."location.href"."parent.location.href".&qu ...

  7. js中window.location.href,location.href,parent.location.href,top.location.href的用法

    "window.location.href"."location.href"是本页面跳转 "parent.location.href"是上一 ...

  8. asp.net mvc 地址栏传输信息报错:window.location.pathname

    asp.net mvc 地址栏传输信息报错:window.location.pathname 前端cshtml代码内容 代码片. // 页面跳转 window.location.pathname = ...

  9. window.location.href跳转无效 IE Bug【转载】

    window.location.href跳转的ie bug 2010-10-25 17:36 http://support.microsoft.com/kb/190244/en-us 在ie下,< ...

最新文章

  1. 使用XML记录数据的一些体会
  2. android 怎么加链接地址,Android TextView添加超链接的方法示例
  3. getpeername()函数
  4. C++ Primer 5th笔记(chap 18 大型程序工具) 重载与命名空间
  5. [codevs 1916] 负载平衡问题
  6. How to remove the dotted border on Active link state---移除链接激活时出现的虚线
  7. 在Windows XP中对系统文件(页面文件和注册表)进行碎片整理
  8. mysql8.0 tar安装_CentOS7安装MySQL8.0 tar包
  9. kafka基础之介绍和分布式集群搭建
  10. java中子类继承父类时是否继承构造函数
  11. SAP NOTE远程下载及电子证书配置
  12. 安卓手机上最好的3个azw3阅读器
  13. java开源项目-六个经典的 SpringBoot 练手项目
  14. 双向链表排序 c++
  15. 计算机卸载打不开,电脑卸载wps后excel打不开怎么办
  16. SSDB:高性能数据库服务器
  17. oracle sqlplus 退格,Oraclesqlplus中方向键、退格键的使用
  18. DC-4靶场练习—teehee提权
  19. [iOS] MUI-WebView模式集成到iOS应用
  20. HTML——表格、表格嵌套、表格布局

热门文章

  1. WCF学习- 体系结构
  2. ubuntu文件、目录操作基本命令
  3. Log4Net ,.net和SQL Server的完美结合
  4. 查询某一个表的字段和数据类型
  5. s5-2 Cpu调度算法
  6. 10.2-linux文件与目录管理
  7. LVS负载均衡群集部署之——DR模式的介绍及搭建步骤
  8. 组件中使用_React四种组件通信详解
  9. php pdo 封装类,php pdo封装类代码(支持事务)
  10. 282天,汇付天下“冲上云霄”