title: ASP.NET MVC attaches current path to remote Url Request
body: <p>I am trying to display a remote web app in a modal div.  All of this code was already created in an Asp.net webforms app.  I am trying to reproduce it in an MVC App using the code that is already written.  It uses Javascript to create an iFrame to display the application in a modal popup.  The problem that I am having is that at some point (I can't figure out where or when after stepping through the code), MVC concatenates the current window location with the RequestedUrl and I end up with the following error:</p>
  
  <p><a href="https://i.stack.imgur.com/IKPmV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IKPmV.png" alt="enter image description here"></a></p>
  
  <p>The function that creates the iFrame in the popup is:</p>
  
  <pre><code>function CreateModalPopupHtmlElementsExitWithClickSave(ModalBoxDivObject, TargetDivName, TargetSource, TargetWidth, TargetHeight, ButtonText, SpanText) {
  
      var iframe = CreateHtmlElement('div', { 'id': 'iframeDiv' });
      iframe.innerHTML = "&lt;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'/&gt;";
      ModalBoxDivObject.appendChild(iframe);
  
      var div = CreateHtmlElement('div', { 'id': 'CloseDiv' });
      div.innerHTML = "&lt;div style='text-align: center;'&gt;&lt;span id='txt' style='font-family:arial;background-color: White;'&gt;" + SpanText + "&lt;/span&gt;&lt;input type='button' onclick='HideModalDivExitWithClickSave();' value='" + ButtonText + "' id='HideModalDivButton' /&gt;&lt;/div&gt;"
  
      ModalBoxDivObject.appendChild(div);
  }
  </code></pre>
  
  <p>The Target is set with the following function:</p>
  
  <pre><code>   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 + '&amp;Edx=' + Guid + '&amp;y=' + selectedYear, 'Close', 'Click to close window.&amp;nbsp;&amp;nbsp;&amp;nbsp;');
      }
  </code></pre>
  
  <p>The target is set correctly when it hits the function that sets up the iFrame:</p>
  
  <p><a href="https://i.stack.imgur.com/gTI2v.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gTI2v.png" alt="enter image description here"></a></p>
  
  <p>When it hits the function the (TargetSource) is the correct Url, but when the popup displays, MVC has added the current window location to it.  How do I remove the default web path from the RequestedUrl?</p>
  
  <p>Any assistance is greatly appreciated.</p>