Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Getting Error The remote server returned an error: (401) unauthorized

$
0
0
Hello, I'm trying to access a text file from web site using the code below but I get an error message stating "The remote server returned an error: (401) unauthorized”

If I manually click on the link I can get to the document but I get the error above when trying to access the document via code.

I did make sure that my text document was set up with read write for network services also but still get the error message.

Any ideas what I might be doing wrong?


Using Client = New Net.WebClient()
           Dim Text As String = Client.DownloadString("http://website.com/Testfolder/SystemList.txt")
           MsgBox(Text)
      End Using 


The error I get appears on this line of code
 Client.DownloadString("http://website.com/Testfolder/SystemList.txt")


By the way the link in the code example is not the real link I'm using but meant just for demonstration purposes so it will not work if you try it.

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>