title: SharePoint Login Credential
body: <p>Currently I try to developed application by using SharePoint that retrieve data from List</p>
  
  <p>Now I try to developed for Login Function, The error display as Below</p>
  
  <p><strong>The underlying connection was closed: An unexpected error occurred on a send.</strong></p>
  
  <p>Here with my Source Code</p>
  
  <pre><code>string WebUrl = "https://xxx.sharepoint.com/sites/devspace";
              string username = txtUsername.Text;
              string pwd = txtPassword.Text;
  
              ClientContext context = new ClientContext(WebUrl);
              Web web = context.Web;
  
              SecureString passWord = new SecureString();
              foreach (char c in pwd.ToCharArray())
                  passWord.AppendChar(c);
              context.Credentials = new SharePointOnlineCredentials(username, passWord);
              try
              {
                  context.Load(web);
                  context.ExecuteQuery();
                  lblStatus.Text = "Olla " + web.Title;
  
              }catch(Exception ex)
              {
                  lblStatus.Text = ex.Message.ToString();
              }
  </code></pre>
  
  <p>Any suggestion for this? Thank in advanced.</p>
  
  <p><strong>Updated:</strong></p>
  
  <p>I'm using SharePoint 2016, login via Windows Server AD.</p>