I want to use BITS to transfer some files between a client and a custom server. The server is hosted in IIS with an ASP.NET web api controller. I'm trying to send credentials to the server to authorize only downloads from my clients but I'm failing to recover those credentials on the server via c#. I can't find it in the header or anywhere in the request (I've tried to analyze it thanks to WireShark).
Here are the command lines I'm using to create the BITS job on my client.
bitsadmin /Create "testCredentials2"
bitsadmin /AddFile "testCredentials2" "http://10.0.0.146/df/api/docs/downloaddummy" "D:\temp\fileoverBits"
bitsadmin /SetCredentials "testCredentials2" SERVER BASIC "login" "password"
bitsadmin /Resume "testCredentials2"
EDIT
Someone helped me find the answer right after I asked. My api should first senf back a response asking for the auhentification. It's done like this
var response = new HttpResponseMessage(HttpStatusCode.Unauthorized);
response.Headers.Add("WWW-Authenticate", "Basic realm=\"localhost\"");
return response;