Using C# code I would like to download artifacts (zip file) from teamcity.
Based on the TC documentation (https://confluence.jetbrains.com/display/TCD8/Accessing+Server+by+HTTP and ) I wrote this code
string artifactSource = @"http://testuser:testpassword@teamcity.mydomain/httpAuth/downloadArtifacts.html?buildTypeId=ExampleBuildType&buildId=lastSuccessful";
using(WebClient teamcity = new WebClient())
{
teamcity.DownloadFile(artifactSource, @"D:\Downloads\1.zip");
}
In Visual Studio i got: An unhandled exception of type 'System.Net.WebException' occurred in System.dll Additional information: The remote server returned an error: (401) Unauthorized.
When I type url into browser I get correct response (file is ready to download).What I am doing wrong? Should I do authorization differently?