I have a WCF service hosted in IIS on Domain 1. This service is accepting a request to upload a file, and then uploading the file to a SharePoint 2010 Server on Domain 2, using the client object model.
Everything works fine when I hardcode the username, password & domain using:
context.Credentials = new NetworkCredential(login, password, domain);
However, due to the compliance & security we cannot do this in our company. We need to use integrated security if possible. I have tried setting the credentials to both
context.Credentials = CredentialCache.DefaultCredentials; context.Credentials = CredentialCache.DefaultNetworkCredentials;
But neither appear to work, we receive the error
System.Net.WebException: The remote server returned an error: (401) Unauthorized. at System.Net.HttpWebRequest.GetResponse() at Microsoft.SharePoint.Client.SPWebRequestExecutor.Execute() at Microsoft.SharePoint.Client.ClientContext.GetFormDigestInfoPrivate() at Microsoft.SharePoint.Client.ClientContext.EnsureFormDigest() at Microsoft.SharePoint.Client.ClientContext.ExecuteQuery()
Can someone provide any tips on how to fix this? Or tips that might lead us to the resolution, logs to check etc. I am not the developer of the SharePoint site, but can chase them down. I have gone through many questions/answers here and none seem to help us.