This project is read-only.

Authentication issues - The requested resource requires user authentication

Aug 2, 2013 at 3:55 PM
I have a windows client application where users are uploading large files to our servers. We are creating a job and not adding credentials (using Windows Auth). However, I am having some problems getting authentication to work. My server is returning a 401 with fhe following headers. It does not look like BITS is responding with an authorization header, and is instead, just erroring the job.

Note that this works when I am uploading a file to a BITS server locally, but once I deploy this into our environment, I cannot upload from my machine to the server.

Below are the headers from the BITS_POST response.

Please advice.

HTTP/1.1 401 Unauthorized
Content-Type: text/html
Server: Microsoft-IIS/7.5
WWW-Authenticate: Negotiate
WWW-Authenticate: NTLM
X-Powered-By: ASP.NET
Date: Fri, 02 Aug 2013 14:51:11 GMT
Content-Length: 1293
Proxy-Support: Session-Based-Authentication
Nov 15, 2013 at 4:28 PM
I know this is old, but here is how I do it:
BitsCredentials bc = new BitsCredentials();
bc.AuthenticationScheme = AuthenticationScheme.Ntlm;
bc.UserName = _sDomain + @"\" + _sUsername;
bc.Password = _sPassword;
bc.AuthenticationTarget = AuthenticationTarget.Server;