title: Connection to CRM
body: <p>I need my website to connect to CRM this is my code</p>
  
  <pre><code>        var organizationUri = new Uri(ConfigurationManager.AppSettings["CRMServerUrl"]);
  
          //Client credentials
          var credentials = new ClientCredentials();
          credentials.UserName.UserName = @"&lt;user&gt;";
          credentials.UserName.Password = "&lt;password&gt;";
          // Use the Microsoft Dynamics CRM Online connection string from the web.config file named "CrmConnectionStr".
          using (OrganizationServiceProxy _service = new OrganizationServiceProxy(organizationUri, null, credentials, null))
          {
              Response.Write("Connected");
          }
  </code></pre>
  
  <p>and this is in my web.config</p>
  
  <pre><code> &lt;add key="CRMServerUrl" value="http://XXXXX/XRMServices/2011/Organization.svc" /&gt;
  &lt;add key="username" value="&lt;user&gt;" /&gt;
  &lt;add key="password" value="&lt;password&gt;" /&gt;
  </code></pre>
  
  <p>it gives me this error message: </p>
  
  <blockquote>
    <p>"A critical error has occurred. Unable to connect with CRM server. The
    caller was not authenticated by the service."</p>
  </blockquote>