I have a farm solution (webpart) using Client object model and when deploy to SharePoint it throw 401 unauthorized error.
when I use this with my user and pass hardcoded in this line then it'll work
NetworkCredential credentials = new NetworkCredential("username", "pass", "domain");
context.Credentials = credentials;
But when I use default credential as below then throw 401 error.
context.Credentials = CredentialCache.DefaultCredentials;
I tested with console app and both line are working with no error, it just the default credential in deploy to sharepoint 2013, error happening.
Domain name and netbios name are different.
Appriciate any help.
.