download teamcity artifact from code

Hi

I am using C# code for download teamcity artifact and i use simple code for download file with network
credentions



string CodeUrl = "http://build:7777/repository/download/bt4/11/build.11.zip";


string FilePath = "c:\\build.11.zip";


using (WebClient client = new WebClient())

{

     client.Credentials =


new NetworkCredential("admin", "12345");

     client.DownloadFile(CodeUrl, FilePath);

}




and it save me html with login page. I use correct login and password and dont understand why i doesnt work.


and the same code work if i try get some changes from REST API Plugin http://build:7777/httpAuth/app/rest/changes?build=id:5



How to fix that?

Please sign in to leave a comment.