Apache Lounge



Forum Index Downloads Search Register Log in  RSS Apache Lounge

Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.



A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Apache Lounge is not sponsored.

Your donations will help to keep this site alive and well, and continuing building binaries.

VB.NET code Cannot Connect to Apache HTTP

Post new topic   Reply to topic    Apache Forum Index -> Coding & Scripting Corner

View previous topic :: View next topic  
Author Message

Joined: 16 Jun 2015
Posts: 1

PostPosted: Tue 16 Jun '15 20:49    Post subject: VB.NET code Cannot Connect to Apache HTTP Reply with quote

Our main data supplier is changing their download server from an IBM Domino HTTP server to an IBM Apache HTTP server. Our current working production VB.NET 4.0 code cannot access the new test Apache server, getting an error: (401) Unauthorized.

I can login to the new test server in IE11 or Chrome using this format: https://extractstest.foo.org/ftp/filename/

Current Code Snippet:

Dim pageHtml As String

Dim methodName As String = "ExtractFile.GetPageHtml: "

Dim myCred As New NetworkCredential("user","password")

Dim wClient As New WebClient

wClient.Credentials = myCred

Dim pageData As Byte() = wClient.DownloadData("https://extractstest.foo.org/ftp/filename")

pageHtml = System.Text.Encoding.ASCII.GetString(pageData)
Back to top
James Blond

Joined: 19 Jan 2006
Posts: 6452
Location: Germany, Next to Hamburg

PostPosted: Wed 17 Jun '15 12:39    Post subject: Reply with quote

If you are using a WebClient to retrieve the file, supply it with a NetworkCredential object like so:

Dim wc As New WebClient() With {
.Credentials = New NetworkCredentials("MyUserName", "MyPassword")
Back to top

Post new topic   Reply to topic    Apache Forum Index -> Coding & Scripting Corner
Page 1 of 1