ASP.NET MVC将当前路径附加到远程Url请求

时间:2016-02-16 16:55:58

标签: javascript asp.net-mvc asp.net-mvc-routing

我正在尝试在模式div中显示远程Web应用程序。所有这些代码都已在Asp.net webforms应用程序中创建。我试图使用已经编写的代码在MVC应用程序中重现它。它使用Javascript创建iFrame以在模态弹出窗口中显示应用程序。我遇到的问题是,在某些时候(我无法弄清楚在单步执行代码之后的位置或时间),MVC将当前窗口位置与RequestedUrl连接起来,最终出现以下错误:

enter image description here

在弹出窗口中创建iFrame的功能是:

function CreateModalPopupHtmlElementsExitWithClickSave(ModalBoxDivObject, TargetDivName, TargetSource, TargetWidth, TargetHeight, ButtonText, SpanText) {

    var iframe = CreateHtmlElement('div', { 'id': 'iframeDiv' });
    iframe.innerHTML = "<iframe width='" + TargetWidth + "' height='" + TargetHeight + "' id='iframeModalPopup' style='border-width:1px; border-color:#333; background:#FFF; border-style:solid;' src=" + encodeURIComponent(TargetSource) + "' scrolling='yes' marginwidth='1' marginheight='1' frameborder='1'/>";
    ModalBoxDivObject.appendChild(iframe);

    var div = CreateHtmlElement('div', { 'id': 'CloseDiv' });
    div.innerHTML = "<div style='text-align: center;'><span id='txt' style='font-family:arial;background-color: White;'>" + SpanText + "</span><input type='button' onclick='HideModalDivExitWithClickSave();' value='" + ButtonText + "' id='HideModalDivButton' /></div>"

    ModalBoxDivObject.appendChild(div);
}

使用以下功能设置目标:

   function ShowManagementdDiv(imageTypeID, Guid, selectedYear) {
        debugger;
        var TargetWidth = 950;
        var TargetHeight = 670;
        bModalPopupActivated = true; window.clearTimeout(t);
        DisplayModalDivExitWithClickSave('box', TargetWidth, TargetHeight, 'http://localhost/PECIMS/DocumentManagement.aspx?eid=' + imageTypeID + '&Edx=' + Guid + '&y=' + selectedYear, 'Close', 'Click to close window.&nbsp;&nbsp;&nbsp;');
    }

当目标到达设置iFrame的函数时,目标设置正确:

enter image description here

当它击中函数时,(TargetSource)是正确的Url,但是当弹出窗口显示时,MVC已将当前窗口位置添加到它。如何从RequestedUrl中删除默认Web路径?

非常感谢任何帮助。

0 个答案:

没有答案