Click here to Skip to main content
15,890,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to access a list in a site collection of different farm using CSOM. But I am getting the error "The remote server returned an error: (401) Unauthorized." Code I used is below.

using (ClientContext ctx = new ClientContext(URL))
{
Web web = ctx.Site.RootWeb;
ctx.Load(web);
ctx.ExecuteQuery();
Console.Write(web.Title);
}

Always getting the authentication error. Is any special confoguration required between farms? Please help. Thanks in advance.

What I have tried:

I tried these steps

ctx.Credentials = CredentialCache.DefaultNetworkCredentials;

ctx.Credentials = new NetworkCredential("username", "password", "domain");

But no use. Still getting the same error. Anything to change in web.config or anywhere? I tried using NTLM webapps and kerbos authentications. No difference.
Posted
Updated 19-Jul-16 23:44pm

1 solution

Pls check whether the user have permission for the particular site/site collection.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900