We are getting an error on the authentication piece when trying to submit a file to the OfficialFile.asmx web service to submit a document to the Drop-Off Library. Here is the code snippet -
public string FileUpload(HttpPostedFile FileInput, RecordsRepositoryProperty[] properties) { string strFileUrl = string.Empty; RecordsRepositorySoapClient repository = new RecordsRepositorySoapClient(); BinaryReader b = new BinaryReader(FileInput.InputStream); byte[] binData = b.ReadBytes(FileInput.ContentLength); repository.ClientCredentials.Windows.ClientCredential = new System.Net.NetworkCredential(iUserID, iUserPassword, iUserDomain); repository.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation; repository.SubmitFile(binData, properties, null, FileInput.FileName, HttpContext.Current.User.Identity.Name); strFileUrl = repository.GetFinalRoutingDestinationFolderUrl(properties, null, FileInput.FileName).Url; return strFileUrl; }
Although we are setting the network credential in the client call we still get the error- The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'Negotiate,NTLM'.
Ideas?
Thanks in advance.