I am trying to use VB.net to connect to a REST API using HTTP Basic Authentication. The authentication succeeds but subsequent requests still yield a 401 error, what am I missing?
Dim Client As New WebClient
Client.Credentials = New NetworkCredential("user","password")
' Works and authenticates
MsgBox(Client.DownloadString("http://site/api/login"))
' Returns 401
MsgBox(Client.DownloadString("http://site/api/helloworld"))
I should add, if I go to /api/login and authenticate in a browser, I can then request /api/helloworld correctly - so the error is client side.