title: Angular 7 to dotnetcore 2.1 web api call gives no response
body: <p>below is the code from login.component.ts,</p>
  
  <pre><code>login() {
  const val = this.form.value;
  
  if (val.email &amp;&amp; val.password) {
    this.authService.login(val.email, val.password)
      .subscribe(
        data =&gt; {
  
          if (data &amp;&amp; data.Token) {
            // store user details and jwt token in local storage to keep user logged in 
            //between page refreshes
            localStorage.setItem('currentUser', JSON.stringify(data));
            console.log("user logged in");
            this.router.navigate([this.returnUrl]);
          } else {
            console.log("user not logged in");
          }
  
        },
        error =&gt; {
          this.error = error;
        });
   }
  }
  </code></pre>
  
  <p>below is the code from angular service,</p>
  
  <pre><code>login(email: string, password: string) {
   return this.http.post&lt;User&gt;(this.baseUrl + "Authenticate", { email, 
  password }, httpOptions);
  }
  </code></pre>
  
  <p>below is the code for dotnetcore 2.1 web api action,</p>
  
  <pre><code>using System;
  using System.IdentityModel.Tokens.Jwt;
  using System.Linq;
  using System.Security.Claims;
  using System.Text;
  using API.Utilities;
  using Business.Models;
  using Microsoft.AspNetCore.Authorization;
  using Microsoft.AspNetCore.Http;
  using Microsoft.AspNetCore.Mvc;
  using Microsoft.Extensions.Options;
  using Microsoft.IdentityModel.Tokens;
  
  
  namespace API.Controllers
  {
    [Authorize]
    [Produces("application/json")]
    [Route("api/[controller]")]
    public class UsersController : BaseController
  {
      private readonly AppSettings _appSettings;
  
      public UsersController(IOptions&lt;AppSettings&gt; appSettings)
      {          
          _appSettings = appSettings.Value;
      }
  
      [AllowAnonymous]
      [HttpPost]
      [Route("Authenticate")]
      public IActionResult Authenticate([FromBody]User userParam)
      {
          var user = Authenticate(userParam.Email, userParam.Password);
  
          if (user == null)
              return BadRequest(new { message = "Username or password is incorrect" });
  
          return Ok(user);
      }
  
  
  
      public User Authenticate(string username, string password)
      {
          //////code goes
  
          return user;
      }
  
  
  }
  } 
  </code></pre>
  
  <p>}</p>
  
  <p>In fiddler always I can see my post request with length as -1. Not sure what is the problem any help?<a href="https://i.stack.imgur.com/nxLAr.png" rel="noreferrer"><img src="https://i.stack.imgur.com/nxLAr.png" alt="attached fiddler screenshot for reference"></a></p>
  
  <p>Below are from the startup.cs. Is there any flaw in my CORS Settings for dotnetcore2.1 WEB API solution</p>
  
  <pre><code>  public void ConfigureServices(IServiceCollection services)
      {
          services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1).
              AddJsonOptions(options =&gt; {
              options.SerializerSettings.ContractResolver = new DefaultContractResolver();
          });
  
          services.AddDistributedMemoryCache();
  
          services.AddSession(options =&gt; {
              // Set a short timeout for easy testing.
              options.IdleTimeout = TimeSpan.FromSeconds(36000);
              options.Cookie.HttpOnly = true;
          });
  
          services.AddCors(options =&gt; {
              options.AddPolicy("CorsPolicy",
              builder =&gt; builder.AllowAnyOrigin()
              .AllowAnyMethod()
              .AllowAnyHeader()
              .AllowCredentials());
          });
      }
  
      // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
      public void Configure(IApplicationBuilder app, IHostingEnvironment env)
      {
          if (env.IsDevelopment())
          {
              app.UseDeveloperExceptionPage();
          }
          else
          {
              app.UseHsts();
          }
  
          app.UseStaticFiles();
  
          app.UseCors(x =&gt; x
          .AllowAnyOrigin()
          .AllowAnyMethod()
          .AllowAnyHeader()
          .AllowCredentials());
          app.UseSession();
          app.UseHttpsRedirection();
          app.UseAuthentication();
          app.UseMvc();
  
      }
  </code></pre>