title: VB6 To send a Form Post
body: <p>Here is the code I am using:</p>
  
  <pre><code>Dim httpReq As New WinHttp.WinHttpRequest
  Dim strLineOut As String
  Dim strReturn As String
  Dim strStatus As String
  
  lblResponse1.Caption = ""
  DoEvents
  strLineOut = "&lt;form name=""form1"" method=""post"" enctype=""multipart/form-data""&gt;" &amp; vbCrLf
  strLineOut = strLineOut &amp; "  &lt;input name=""hdntype"" type=""hidden"" id=""hnd1"" value=""1""&gt;" &amp; vbCrLf
  strLineOut = strLineOut &amp; "  &lt;input name=""hnd1"" type=""hidden"" id=""hnd1"" value=""Value1""&gt;" &amp; vbCrLf
  strLineOut = strLineOut &amp; "  &lt;input name=""hdn2"" type=""hidden"" id=""hdn2"" value=""Value2""&gt;" &amp; vbCrLf
  strLineOut = strLineOut &amp; "  &lt;input type=""submit"" name=""Submit"" value=""Submit""&gt;" &amp; vbCrLf
  strLineOut = strLineOut &amp; "&lt;/form&gt;" &amp; vbCrLf
  
  httpReq.Open "POST", "http://www.XXXX.com/XMLProjects/vb6test/form_post.asp", False
  httpReq.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded"
  'text/xml
  'application/x-www-form-urlencoded
  'httpReq.StatusText
  'httpReq.Status
  'httpReq.SetRequestHeader "Content-Length", Len(strLineOut)
  httpReq.Send (strLineOut)
  strStatus = httpReq.StatusText
  strReturn = httpReq.ResponseText
  Debug.Print strReturn &amp; vbCrLf &amp; strStatus
  lblResponse1.Caption = strReturn &amp; vbCrLf &amp; strStatus
  Set httpReq = Nothing
  </code></pre>
  
  <p>The asp that catches the form cannot seem to recognize the form.  It sees a form with one item.
  The catch code in the asp is:</p>
  
  <pre><code>Response.Write Request.Form("hdntype") 
  Response.Write "the form object is " &amp; Request.Form.Item(1) &amp; vbCrLf
  </code></pre>
  
  <p>The response from the asp is:</p>
  
  <pre><code>the form object is "form1"method="post"enctype="multipart/form-data"&gt;
  &lt;inputname="hdntype"type="hidden"id="hnd1"value="1"&gt;
  &lt;inputname="hnd1"type="hidden"id="hnd1"value="Nick"&gt;
  &lt;inputname="hdn2"type="hidden"id="hdn2"value="Arnone"&gt;
  &lt;inputtype="submit"name="Submit"value="Submit"&gt;&lt;/form&gt;
  </code></pre>
  
  <p>It does not see the item hdntype, or any other item within the form. It sees 1 item, the entire form.</p>
  
  <p>If I do a Request.TotalBytes, I can see everythinhg in the asp.
  If I add a querystring objects, I can see each object. 
  I cannot see form objects.</p>