?
Solved

HTTP Post

Posted on 2013-06-17
2
Medium Priority
?
359 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 2000 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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 article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
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…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

719 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