title: CORS issue in .Net Framework 4.5 with Angular 6
body: <p>I have created API in .Net Framework 4.5 and it's working fine in Postman but When I am implementing with Angular7 then we didn't get Requested Parameters like (Username and Password) in API.</p>
  
  <p>I have already tried these steps:</p>
  
  <p>I have already installed this package
  <code>Microsoft.AspNet.WebApi.Cors</code></p>
  
  <p><strong>DemoController.cs</strong></p>
  
  <pre><code>using Newtonsoft.Json.Linq;
  using System;
  using System.Collections.Generic;
  using System.Data;
  using System.Linq;
  using System.Net;
  using System.Net.Http;
  using System.Threading.Tasks;
  using System.Web;
  using System.Web.Http;
  using System.Web.Http.Cors;
  using System.Web.Http.Description;
  using TestData.Models;
  
  namespace TestData.Controllers
  {
      public class DemoController : ApiController
      {
          [HttpPost]
          [Route("api/Demo/Login")]
          public IHttpActionResult Login(HttpRequestMessage request)
          {
              string username = HttpContext.Current.Request.Form["Username"]; // getting Null
              string pass = HttpContext.Current.Request.Form["Pass"]; // getting Null
              return Ok('Username: ' +username + 'Password :' +pass);
          }
      }
  }
  </code></pre>
  
  <p><strong>WebApiConfig.cs</strong></p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web.Http;
  using System.Web.Http.Cors;
  
  namespace TestData
  {
      public static class WebApiConfig
      {
          public static void Register(HttpConfiguration config)
          {
              // Web API configuration and services
  
              // Web API routes
              config.MapHttpAttributeRoutes();
  
              config.Routes.MapHttpRoute(
                  name: "DefaultApi",
                  routeTemplate: "api/{controller}/{id}",
                  defaults: new { id = RouteParameter.Optional }
              );
              EnableCorsAttribute cors = new EnableCorsAttribute("*", "*", "*");
              config.EnableCors(cors);
          }
      }
  }
  </code></pre>
  
  <p>I am using some code of Angular</p>
  
  <p><strong>auth.service.ts</strong></p>
  
  <pre><code>import { Injectable } from '@angular/core';
  import { HttpClient, HttpHeaders } from '@angular/common/http';
  
  @Injectable({
      providedIn: 'root'
  })
  export class AuthService {
  
      apiUrl : any = 'http://mydomain/api';
  
      constructor(private http : HttpClient) { }
  
      GetHttpHeaders() : HttpHeaders {
          const headers = new HttpHeaders().set('Content-Type', 'application/json');
          return headers;
      }
  
      loginUser() {
          var data = JSON.stringify({
              "Username" : '3333',
              "Pass" : '123456'
          })
          return this.http.post(this.apiUrl+'/Demo/Login', data, { headers : this.GetHttpHeaders() }).subscribe((results) =&gt; {
              console.log(results);
          });
      }
  }
  </code></pre>