HTTPHelper

The HTTPHelper library is a .NET Class that helps programmers do complex HTTP functions such as getting HTTP data from a web server, posting data to a web server, downloading files from a web server, and uploading files to a web server all without having to think about doing all of the complex things.

The HTTPHelper class is now fully open source and all source is available on Bitbucket.org. You can find it at https://bitbucket.org/trparky/httphelper/overview. You can pull down the source and even commit patches to the repository if you find issues with it. Just please, update the version number of the class (the variable name is classVersion) if you happen to submit patches. Patches will have to be approved by me, the maintainer of the code repository, so when you submit patches those patches will not immediately be submitted to the code; I have to approve the patches before it’s pushed to the code tree. Also, if you submit patches try and submit the same patch/fix for both branches, both the VB.NET and C# branches. If you don’t I will apply any and all patches to whatever branch that didn’t get the patch.

There is an extensive API for the Class that allows for simple calls of subroutines to add and delete data from the Class instance to prepare your HTTP request.

Adding additional HTTP headers for your HTTP request is as easy as calling…

Dim httpHelper As New Tom.httpHelper()
httpHelper.addHTTPHeader("myheader", "my header contents")

Adding a cookie is also easy…

httpHelper.addHTTPCookie("mycookie", "my cookie contents", "www.domain.com", "/")

Setting up for GET and POST data is also just as easy…

httpHelper.addGETData("test3", "value3")
httpHelper.addPOSTData("test3", "value3")

Even setting a custom User Agent String is simple…

httpHelper.setUserAgent = "Microsoft .NET"

Once you have set up your Class instance with all of the data you want to send in your HTTP Request, you simply call the getWebData() function like this…

Dim strServerResponse As String = Nothing
If httpHelper.getWebData("http://www.domain.com/", strServerResponse) Then
' Put the things you want to do with your HTTP data once you have it here.
End If

Adding a file to upload is also easy…

httpHelper.addFileUpload("myfileupload", "C:\Path\To\Filename", Nothing, Nothing)

And then call the uploadData() function like so…

httpHelper.uploadData()

Downloading files using this Class library is also just as easy and provides for up-to-the-second status on your download. No more wondering if the download is complete or how long you have left to download it, the Class library keeps you up to date on your download.

The entire library is fully documented with hints and clues as to how to use the Class library while using the IntelliSense support in Visual Studio.

Last updated on Wednesday, November 1st, 2017 at 6:22 PM by trparky.