title: Still getting Access-Control-Allow-Origin Error
body: <p>I have a web application on asp.net that uses Jquery-ajax call to <strong>GET</strong> some data from a restful service. This WCF service working proper that I can call it in my browser with it's '<em>UriTemplate</em>' , next my data will be shown. </p>
  
  <p>But, When I using ajax call to get the content, <strong>Access-Control-Allow-Origin</strong> Error will be logged. Consider that I've been set the Access-Control-Allow-Origin and Header parameters in my web.config file, but didn't get the result.</p>
  
  <p>Error Content:</p>
  
  <pre><code>XMLHttpRequest cannot load http://localhost:8000/MonitorDataProviderService/MonitorData. Origin http://localhost:2265 is not allowed by Access-Control-Allow-Origin.
  </code></pre>
  
  <p>My <strong>ajax call</strong> is in a ascx script block:</p>
  
  <pre><code>function FillDataA()
  {
      console.log("Address is : " + address);
      $.ajax({
          type: "GET",
          url: address,//Address is valid
          contentType: "application/json; charset=utf-8",
          dataType: "json",
          success: function (r) {
              alert("WIN");
          },
          error: function (msg) { console.log("ERROR"); }
      });
      setTimeout(function () { FillDataA(); }, 2000);//The method is calling continuously 
  }
  </code></pre>
  
  <p><strong>Config</strong> file tags:</p>
  
  <pre><code>&lt;system.webServer&gt;
      &lt;httpProtocol&gt;
        &lt;customHeaders&gt;
          &lt;add name="Access-Control-Allow-Origin" value="http://localhost:2265" /&gt;
          &lt;add name="Access-Control-Allow-Headers" value="Content-Type, Accept" /&gt;
        &lt;/customHeaders&gt;
      &lt;/httpProtocol&gt;
  &lt;/system.webServer&gt;
  </code></pre>
  
  <p>Also, Adding it on <strong>Global.asax</strong> wasn't helpful:</p>
  
  <pre><code>     protected void Application_BeginRequest(object sender, EventArgs e)
          {
  HttpContext.Current.Response.AddHeader("Access-Control-Allow-Origin",
                            "*"); 
  // I've Tested fixed url in place of '*' too
  
              if (HttpContext.Current.Request.HttpMethod == "OPTIONS")
              {
                  HttpContext.Current.Response.AddHeader("Access-Control-Allow-Methods", 
                                "GET, POST");
                  HttpContext.Current.Response.AddHeader("Access-Control-Allow-Headers",
                                "Content-Type, Accept");
                  HttpContext.Current.Response.AddHeader("Access-Control-Max-Age",
                                "1728000");
                  HttpContext.Current.Response.End();
              }
          }
  </code></pre>
  
  <p><strong>Browsers</strong> Used:
   - Chrome 28
   - Firefox 22.0</p>
  
  <p>Any Helpful idea will be appreciated</p>
  
  <p>Best Regards</p>