DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2011

    Thumbs down sending a text file and params over HTTP post (vb.net )

    I am trying to post to a WebForm,
    It takes several params.

    the aspx page is

    <body MS_POSITIONING="GridLayout">
    <form id="Form1" method="post" enctype="multipart/form-data" action="WebLogin.aspx">
    <INPUT type="file" id="File1" name="File1">
    <input type="submit" id="Submit1" value="Upload">
    <INPUT type="text" id="txtLastName" name="Last_Name" value="Marcey">
    <INPUT type="text" id="txtUserId" name="User_Id" value="administrator">
    <INPUT type="text" id="txtCustomerNumber" name="Customer_Number" value="999999">
    <INPUT type="text" size="18" id="txtPassword" name="Password" value="TooManySecrets">
    <input type="text" id="txtversion" name = "version" value="1">

    I am trying to use webpost

    here is my code

    Dim cPostData As String
    Dim cParamName1 As String = "File1="
    Dim cParamName2 As String = "Submit1="
    Dim cParamName3 As String = "last_name="
    Dim cParamName4 As String = "user_id="
    Dim cParamName5 As String = "customer_number="
    Dim cParamName6 As String = "password="
    Dim cParamName7 As String = "version="

    Dim sFileName As String = tbFile.Text
    Dim sUpload As String = "Upload"
    Dim sLastname As String = tbLastName.Text
    Dim sLogin As String = tbLogin.Text
    Dim sCustNum As String = tbCustNum.Text
    Dim sPassword As String = tbPassWord.Text
    Dim sVersion As String = tbVersion.Text
    Dim sURL As String = "http://localhost:3868/WebLOGIN.aspx"
    Dim cSeparator As String
    cSeparator = "&"

    cPostData = cParamName1 & sFileName & cSeparator & cParamName2 & sUpload & cSeparator & cParamName3 & sLastname & cSeparator & cParamName4 & sLogin & cSeparator & cParamName5 & sCustNum & cSeparator & cParamName6 & sPassword & cSeparator & cParamName7 & sVersion

    Dim Myweb As New WebClient
    Myweb.Headers.Add("Content-Type", "application/x-www-form-urlencoded")
    Dim byteArray As Byte() = System.Text.Encoding.ASCII.GetBytes(cPostData)
    Dim responseArray As Byte() = Myweb.UploadData(sURL, "POST", byteArray)
    Dim test As String = System.Text.Encoding.ASCII.GetString(responseArray)

  2. #2
    Join Date
    Mar 2011
    Why are you using a parameter file. Can you use a session or context variable instead?


  3. #3
    Join Date
    Oct 2008

    submitting a web form with post method

    hi there,

    i posted a short description on how i submitted a web form with post method.
    it is here --> http://dotnetflux.blogspot.com/

    good luck,

    tonci korsano

Similar Threads

  1. How to pass string to concatenate routine.
    By haran415 in forum VB Classic
    Replies: 4
    Last Post: 04-15-2007, 10:40 AM
  2. Replies: 0
    Last Post: 04-19-2002, 06:07 AM
  3. Replies: 0
    Last Post: 04-19-2002, 06:02 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center

By using this site, you agree to the Privacy Policy