Solved

HTTP Post

Posted on 2013-06-17
2
355 Views
Last Modified: 2013-06-18
In VB.Net, how can I test the ability to make an HTTP Post to a URI?
0
Comment
Question by:lrbrister
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 25

Accepted Solution

by:
Ron Malmstead earned 500 total points
ID: 39254725
http://stackoverflow.com/questions/8222092/sending-http-post-with-system-net-webclient


..here's a piece of code I made that seems to work.
Imports System.Web

 Dim MyClient As New WebClient
 
       Dim ServerResponse as string = ""
        Dim WebRequestString As String = ""
        Dim   OutURL As String = "http://www.yourdomain.com/yourpostpage.php"

'Add some form values
MyClient.QueryString.Add("keyname", "keyvalue")

       Try
              MyClient.Headers.Add("Content-Type", "application/x-www-form-urlencoded")

              Dim bytResponse As Byte() = MyClient.UploadValues(OutURL, MyClient.QueryString)

              ServerResponse = System.Text.ASCIIEncoding.ASCII.GetString(bytResponse)

        Catch ex As Exception
                                FinalResult = ex.Message
                                FailureTrackCount = FailureTrackCount + 1
        End Try

Open in new window

0
 

Author Closing Comment

by:lrbrister
ID: 39257050
Thanks
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question