mikefourie-zz / MSBuildExtensionPack

MIT License
366 stars 104 forks source link

Request to add HTTP authentication support to WebClient #77

Open varakreivi opened 6 years ago

varakreivi commented 6 years ago

Currently, the HttpWebRequest task(s) support giving UserName and UserPassword as parameters to enable basic HTTP authentication (added in revision 890 by wayne.bradney). I would like to be able to use the same logic for WebClient.DownloadFile, as our build automation flow relies on querying for build artifacts through TeamCity server's REST API and downloading the latest ones.

I moved the following lines of code locally into WebClient.cs to DownloadFile and OpenRead functions, and checked that the solution works for me simply by replacing the resulting DLL, but it would be great to have official support for this as well:

if (!string.IsNullOrEmpty(this.UserName)) { client.Credentials = new System.Net.NetworkCredential(this.UserName, this.UserPassword); }

I'm attaching the file I made changes to.

WebClient.zip

varakreivi commented 5 years ago

Any update or schedule on this issue? Just updating to say that it is still relevant.