DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2011
    Posts
    1

    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">
    <br>
    <input type="submit" id="Submit1" value="Upload">
    <br>
    <INPUT type="text" id="txtLastName" name="Last_Name" value="Marcey">
    <br>
    <INPUT type="text" id="txtUserId" name="User_Id" value="administrator">
    <br>
    <INPUT type="text" id="txtCustomerNumber" name="Customer_Number" value="999999">
    <br>
    <INPUT type="text" size="18" id="txtPassword" name="Password" value="TooManySecrets">
    <br>
    <input type="text" id="txtversion" name = "version" value="1">
    <br>
    </form>
    </body>




    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
    Posts
    1
    Why are you using a parameter file. Can you use a session or context variable instead?

    Mark

  3. #3
    Join Date
    Oct 2008
    Posts
    141

    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

Bookmarks

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
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links