Reputation: 5370
I'm calling a clients endpoint which "get" a json array. Like so
var json = new WebClient().DownloadString(url);
They are using authentication and i have the username and password. Is it possible to submit the username and password. Maybe i need to add custom headers? I can't find the exact examples for what i'm after
401 - Unauthorized: Access is denied due to invalid credentials.
Upvotes: 0
Views: 167
Reputation: 431
You may try to specify your credentials:
var json = new WebClient { Credentials = new NetworkCredential(username, passwd) }.DownloadString(url);
Upvotes: 1