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
Solved

HTTP Post

Posted on 2013-06-17
2
352 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
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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
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…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

856 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