javascript - 新窗口在“/”应用程序中收到服务器错误
问题描述
我收到的错误是:
“/”应用程序中的服务器错误。
无法找到该资源。说明:HTTP 404。您要查找的资源(或其依赖项之一)可能已被删除、名称已更改或暂时不可用。请查看以下 URL 并确保其拼写正确。
请求的 URL:/home/WC_public/default.aspx
版本信息:Microsoft .NET Framework 版本:4.0.30319;ASP.NET 版本:4.7.3282.0
如果我在 2012 版本上运行构建/调试,我们目前正在从 Visual Studio 2012 升级到 Visual Studio 2017,一切运行良好且没有错误,但如果我在 2017 年运行它,任何时候我单击链接按钮打开新窗口我得到这个错误
这是被标签击中的代码
<a href="javascript:OpenReports()">Reports</a>
var PDMReports;
函数 OpenReports() {
if (PDMReports == null) {
PDMReports = window.open(window.location.protocol + "//" + window.location.host + window.location.pathname.substring(0, window.location.pathname.indexOf("/", 1) + 1) + "WC_public/default.aspx", "PDMreports", "resizable=no,location=no,titlebar=yes,menubar=yes,status=no,height=600,width=500");
}
else {
try {
PDMReports.location.reload();
PDMReports.location.hash = "";
}
catch (e)
{
PDMReports = window.open(window.location.protocol + "//" + window.location.host + window.location.pathname.substring(0, window.location.pathname.indexOf("/", 1) + 1) + "WC_public/default.aspx", "PDMreports", "resizable=no,location=no,titlebar=yes,menubar=yes,height=600,width=500");
}
}
PDMReports.focus();
}
解决方案
在这种情况下,我能够弄清楚它是
PDMReports = window.open(window.location.protocol + "//" + window.location.host + window.location.pathname.substring(0, window.location.pathname.indexOf("/", 1) + 1) + "WC_public/default.aspx", "PDMreports", "resizable=no,location=no,titlebar=yes,menubar=yes,status=no,height=600,width=500");
那是vs版本之间的问题,出于某种原因,它不再需要路径名子字符串,只需要WC_public/default.aspx
推荐阅读
- c# - 网络 C# 日期时间转换
- javascript - 我想通过单击 ci 中的下载按钮下载 zip 文件中的所有图像
- javascript - 具有多个值的自动完成字段(可移除)
- wordpress - Wordpress 评论框翻译
- gojs - 如何在 GoJS 中创建工业自动化图像并使用它
- regex - 使用组合正则表达式检查密码
- confluence - Confluence API:如何从以前版本的页面中获取内容?
- c - 在 C 语言中使用“GetAsyncKeyState(VK_UP)”和...
- c++ - const cast 和 std launder
- python - Python Json 转储删除“”