首页 > 解决方案 > 新窗口在“/”应用程序中收到服务器错误

问题描述

我收到的错误是:

“/”应用程序中的服务器错误。

无法找到该资源。说明: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();

}

标签: javascriptasp.netvisual-studiovisual-studio-2017

解决方案


在这种情况下,我能够弄清楚它是

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


推荐阅读