Server was unable to process request Access is denied. Connecting to SharePoint

Errors:
Server was unable to process request. —> Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

Object moved
Object moved to

In your project, navigate to the Web Reference folder.
One at a time, open each of your reference folders.
Edit the Reference.cs file (notepad++ or Visual Studio).
Directly after this line: public partial class Lists : System.Web.Services.Protocols.SoapHttpClientProtocol {
Insert the following code:

protected override System.Net.WebRequest GetWebRequest(Uri uri)
{
System.Net.WebRequest wr = base.GetWebRequest(uri);
wr.Headers.Add(“X-FORMS_BASED_AUTH_ACCEPTED”, “f”);
return wr;
}

Save the file.
Try connecting to SharePoint again.
If it works, complete the same update on your other Reference.cs files.