title: Dynamically inject HTML code from a String into an asp.net page
body: <p>I have a page in VB ASP.NET with the following code (this was generated by VS):</p>
  
  <pre><code>&lt;%@ Page Language="VB" AutoEventWireup="false" CodeFile="Payment2.aspx.vb" Inherits="Payment2" %&gt;
  
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head runat="server"&gt;
     &lt;title&gt;&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
     &lt;form id="form1" runat="server"&gt;
       &lt;div&gt;
  
       &lt;/div&gt;
     &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>With code</p>
  
  <pre><code>Partial Class Payment2
     Inherits System.Web.UI.Page
  
     Sub Page_Load(ByVal S As Object, ByVal E As EventArgs)
  
     End Sub
  
  End Class
  </code></pre>
  
  <p>And I want to be able to inject the following String into the page and display.</p>
  
  <pre><code>&lt;form name="downloadform3D" action="https://something.asp" method="post"&gt;
  &lt;NOSCRIPT&gt;
  JavaScript is currently disabled or is not supported by your browser.&lt;br&gt;
  Please click on the &amp;quot;Continue&amp;quot; button to continue&lt;br&gt;
  &lt;input class="ncol" type="submit" value="Continue" id="submit1" name="submit1" /&gt;
  &lt;/NOSCRIPT&gt;
  &lt;input type="hidden" name="CSRFKEY" value="abc" /&gt;
  &lt;input type="hidden" name="CSRFTS" value="abc" /&gt;
  &lt;input type="hidden" name="CSRFSP" value="/ncol/test/something.asp" /&gt;
  &lt;input type="hidden" name="PaReq" value="&lt;?xml version=&amp;quot;1.0&amp;quot;?&gt;&lt;ThreeDSecure&gt;&lt;Message id=&amp;quot;123&amp;quot;&gt;&lt;PAReq&gt;&lt;version&gt;1.02&lt;/version&gt;&lt;Merchant&gt;&lt;merID&gt;abc&lt;/merID&gt;&lt;name&gt;abc&lt;/name&gt;&lt;url&gt;http://www.abc.com&lt;/url&gt;&lt;/Merchant&gt;&lt;Purchase&gt;&lt;xid&gt;123&lt;/xid&gt;&lt;amount&gt;1&lt;/amount&gt;&lt;purchAmount&gt;1&lt;/purchAmount&gt;&lt;currency&gt;GBP&lt;/currency&gt;&lt;/Purchase&gt;&lt;CH&gt;&lt;acctID&gt;12345&lt;/acctID&gt;&lt;expiry&gt;1234&lt;/expiry&gt;&lt;selBrand&gt;&lt;/selBrand&gt;&lt;/CH&gt;&lt;/PAReq&gt;&lt;/Message&gt;&lt;/ThreeDSecure&gt;
  " /&gt;
  &lt;input type="hidden" name="TermUrl" value="https://something.asp" /&gt;
  &lt;input type="hidden" name="MD" value="12334" /&gt;
  &lt;/form&gt;
  &lt;form method="post" action="https://somethig.asp" name="uploadForm3D"&gt;
  &lt;input type="hidden" name="CSRFKEY" value="1234A" /&gt;
  &lt;input type="hidden" name="CSRFTS" value="1234" /&gt;
  &lt;input type="hidden" name="CSRFSP" value="/something.asp" /&gt;
  &lt;input type="hidden" name="branding" value="abc" /&gt;
  &lt;/form&gt;
  &lt;SCRIPT LANGUAGE="Javascript" &gt;
  &lt;!--
  var popupWin;
  var submitpopupWin = 0;
  
  function LoadPopup() {
  if (self.name == null)  {
      self.name = "ogoneMain";
  }
  popupWin = window.open('about:blank', 'popupWin', 'height=400, width=390, status=yes, dependent=no, scrollbars=yes, resizable=no');
  if (popupWin != null) {
      if  (!popupWin || popupWin.closed) {
          return 1;
      } else {
          if (!popupWin.opener || popupWin.opener == null) {
              popupWin.opener = self;
          }
          self.document.forms.downloadform3D.target = 'popupWin';
          if (submitpopupWin == 1) {
              self.document.forms.downloadform3D.submit();
          }
          popupWin.focus();
          return 0;
      }
  } else {
      return 1;
  }
  }
  self.document.forms.downloadform3D.submit();
  //--&gt;
  &lt;/SCRIPT&gt;
  </code></pre>
  
  <p>I've had a look on google but nothing has helped (I may be entering the wrong search terms as I'm new to web programming).  Any help would be really appreciated as I'm not an ASP guy and I've been pulling out what little hair I have left now for 3 days :(</p>
  
  <p>Thanks in advance.</p>