
Need help with POST method to an asp page
I am trying to do a POST method to an ASP page I have created that will
return in information. The problem is that the VB.Net code below is
returning the actual ASP code for that page (hiddenpage.asp) and not
returning the information I need (from resultcode.asp). Can anyone help?
Option Strict On
Option Explicit On
Imports System.Net
Imports System.Net.Sockets
Imports System
Imports Scripting
Imports System.Management
Imports System.Text
Imports System.IO
Dim webAddress As String = " http://www.*-*-*.com/ ;
Dim webClientID As WebClient = New WebClient()
Dim parameterTable As New
System.Collections.Specialized.NameValueCollection()
With parameterTable
.Add("COMPANYNAME", "ABC, Inc.")
.Add("USERNAME", "SPEEDY RABBIT")
.Add("OTHERINFO", "123456789")
End With
Dim responseArray As Byte() = webClientID.UploadValues(webAddress, "POST",
parameterTable)
Debug.Write(System.Text.Encoding.ASCII.GetString(responseArray))
***********************************************************************
hiddenpage.asp
<FORM Name="Registration Form" ACTION="resultCode.asp" METHOD="POST">
Company Name: <INPUT TYPE="TEXT" NAME="COMPANYNAME"> <BR>
User Name: <INPUT TYPE="TEXT" NAME="USERNAME"> <BR>
Other Info: <INPUT TYPE="TEXT" NAME="OTHERINFO"> <BR>
<INPUT TYPE=RESET VALUE="CLEAR">
<INPUT TYPE=SUBMIT VALUE="SUBMIT">
</FORM>
************************************************************************
resultcode.asp
<% 'VBScript
Response.Write "Your special number is: 123943" & "<BR>"
Response.Write "For Company: " & Request.Form(1)
%>