Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

try to use the CredentialCache (from memory) :

using (ClientContext context = new ClientContext("http://localhost"))
{
    CredentialCache cc = new CredentialCache();
    NetWorkCredential nc = new NetworkCredential("username", "password", "domain"); 

    cc.Add(new Uri("http://localhost"), "Negotiate", nc));

    context.Credentials = cc; 

    Web web = context.Web;
     context.Load(web);

    Log.Debug("Loading web.");
    context.ExecuteQuery();

    Console.WriteLine(web.Title);
}

there are also others cases where the return http code is 401, and subcode 401.1 or 401.2. Unfortunately the only way to discover them is to look inside IIS logs. the two have some causes that can be threated with different solutions. Tell us if it's the case.

[Edit] As you said you have a 401.2 error, take a look at my former answer here : 401 IIS Error for SearchAdmin.asmx401 IIS Error for SearchAdmin.asmx. I bet it's the same.

try to use the CredentialCache (from memory) :

using (ClientContext context = new ClientContext("http://localhost"))
{
    CredentialCache cc = new CredentialCache();
    NetWorkCredential nc = new NetworkCredential("username", "password", "domain"); 

    cc.Add(new Uri("http://localhost"), "Negotiate", nc));

    context.Credentials = cc; 

    Web web = context.Web;
     context.Load(web);

    Log.Debug("Loading web.");
    context.ExecuteQuery();

    Console.WriteLine(web.Title);
}

there are also others cases where the return http code is 401, and subcode 401.1 or 401.2. Unfortunately the only way to discover them is to look inside IIS logs. the two have some causes that can be threated with different solutions. Tell us if it's the case.

[Edit] As you said you have a 401.2 error, take a look at my former answer here : 401 IIS Error for SearchAdmin.asmx. I bet it's the same.

try to use the CredentialCache (from memory) :

using (ClientContext context = new ClientContext("http://localhost"))
{
    CredentialCache cc = new CredentialCache();
    NetWorkCredential nc = new NetworkCredential("username", "password", "domain"); 

    cc.Add(new Uri("http://localhost"), "Negotiate", nc));

    context.Credentials = cc; 

    Web web = context.Web;
     context.Load(web);

    Log.Debug("Loading web.");
    context.ExecuteQuery();

    Console.WriteLine(web.Title);
}

there are also others cases where the return http code is 401, and subcode 401.1 or 401.2. Unfortunately the only way to discover them is to look inside IIS logs. the two have some causes that can be threated with different solutions. Tell us if it's the case.

[Edit] As you said you have a 401.2 error, take a look at my former answer here : 401 IIS Error for SearchAdmin.asmx. I bet it's the same.

edited body
Source Link
Steve B
  • 7.6k
  • 9
  • 54
  • 110

try to use the CredentialCache (from memory) :

using (ClientContext context = new ClientContext("http://localhost"))
{
    CredentialCache cc = new CredentialCache();
    NetWorkCredential nc = new NetworkCredential("username", "password", "domain"); 

    cc.Add(new Uri("http://localhost"), nc"Negotiate", "Negociate"nc));

    context.Credentials = cc; 

    Web web = context.Web;
     context.Load(web);

    Log.Debug("Loading web.");
    context.ExecuteQuery();

    Console.WriteLine(web.Title);
}

there are also others cases where the return http code is 401, and subcode 401.1 or 401.2. Unfortunately the only way to discover them is to look inside IIS logs. the two have some causes that can be threated with different solutions. Tell us if it's the case.

[Edit] As you said you have a 401.2 error, take a look at my former answer here : 401 IIS Error for SearchAdmin.asmx. I bet it's the same.

try to use the CredentialCache (from memory) :

using (ClientContext context = new ClientContext("http://localhost"))
{
    CredentialCache cc = new CredentialCache();
    NetWorkCredential nc = new NetworkCredential("username", "password", "domain"); 

    cc.Add(new Uri("http://localhost"), nc, "Negociate"));

    context.Credentials = cc; 

    Web web = context.Web;
     context.Load(web);

    Log.Debug("Loading web.");
    context.ExecuteQuery();

    Console.WriteLine(web.Title);
}

there are also others cases where the return http code is 401, and subcode 401.1 or 401.2. Unfortunately the only way to discover them is to look inside IIS logs. the two have some causes that can be threated with different solutions. Tell us if it's the case.

[Edit] As you said you have a 401.2 error, take a look at my former answer here : 401 IIS Error for SearchAdmin.asmx. I bet it's the same.

try to use the CredentialCache (from memory) :

using (ClientContext context = new ClientContext("http://localhost"))
{
    CredentialCache cc = new CredentialCache();
    NetWorkCredential nc = new NetworkCredential("username", "password", "domain"); 

    cc.Add(new Uri("http://localhost"), "Negotiate", nc));

    context.Credentials = cc; 

    Web web = context.Web;
     context.Load(web);

    Log.Debug("Loading web.");
    context.ExecuteQuery();

    Console.WriteLine(web.Title);
}

there are also others cases where the return http code is 401, and subcode 401.1 or 401.2. Unfortunately the only way to discover them is to look inside IIS logs. the two have some causes that can be threated with different solutions. Tell us if it's the case.

[Edit] As you said you have a 401.2 error, take a look at my former answer here : 401 IIS Error for SearchAdmin.asmx. I bet it's the same.

added 240 characters in body
Source Link
Steve B
  • 7.6k
  • 9
  • 54
  • 110

try to use the CredentialCache (from memory) :

using (ClientContext context = new ClientContext("http://localhost"))
{
    CredentialCache cc = new CredentialCache();
    NetWorkCredential nc = new NetworkCredential("username", "password", "domain"); 

    cc.Add(new Uri("http://localhost"), nc, "Negociate"));

    context.Credentials = cc; 

    Web web = context.Web;
     context.Load(web);

    Log.Debug("Loading web.");
    context.ExecuteQuery();

    Console.WriteLine(web.Title);
}

there are also others cases where the return http code is 401, and subcode 401.1 or 401.2. Unfortunately the only way to discover them is to look inside IIS logs. the two have some causes that can be threated with different solutions. Tell us if it's the case.

[Edit] As you said you have a 401.2 error, take a look at my former answer here : 401 IIS Error for SearchAdmin.asmx. I bet it's the same.

try to use the CredentialCache (from memory) :

using (ClientContext context = new ClientContext("http://localhost"))
{
    CredentialCache cc = new CredentialCache();
    NetWorkCredential nc = new NetworkCredential("username", "password", "domain"); 

    cc.Add(new Uri("http://localhost"), nc, "Negociate"));

    context.Credentials = cc; 

    Web web = context.Web;
     context.Load(web);

    Log.Debug("Loading web.");
    context.ExecuteQuery();

    Console.WriteLine(web.Title);
}

there are also others cases where the return http code is 401, and subcode 401.1 or 401.2. Unfortunately the only way to discover them is to look inside IIS logs. the two have some causes that can be threated with different solutions. Tell us if it's the case

try to use the CredentialCache (from memory) :

using (ClientContext context = new ClientContext("http://localhost"))
{
    CredentialCache cc = new CredentialCache();
    NetWorkCredential nc = new NetworkCredential("username", "password", "domain"); 

    cc.Add(new Uri("http://localhost"), nc, "Negociate"));

    context.Credentials = cc; 

    Web web = context.Web;
     context.Load(web);

    Log.Debug("Loading web.");
    context.ExecuteQuery();

    Console.WriteLine(web.Title);
}

there are also others cases where the return http code is 401, and subcode 401.1 or 401.2. Unfortunately the only way to discover them is to look inside IIS logs. the two have some causes that can be threated with different solutions. Tell us if it's the case.

[Edit] As you said you have a 401.2 error, take a look at my former answer here : 401 IIS Error for SearchAdmin.asmx. I bet it's the same.

Source Link
Steve B
  • 7.6k
  • 9
  • 54
  • 110
Loading