1

My app is integrated with ASP.NET MVC and works with a cookie-based authentication.

At first, I run a config method to get the basic user ID & culture that needs to pass in subsequent calls, using APP_INITIALIZER, this resolved in 72 ms:

enter image description here

This sets a cookie in the browser via

Response header:

Set-Cookie: access-cookie=iT0VQOmOIn-NcJNGoJ3Qc32iLUnxsyIe3GLexNmtqq6sIiGSEHCCs8unI-m_F_hZsVmwtlLRPx-5zxomc5tusNXDC5I1; expires=Thu, 28 May 2020 21:42:21 GMT; path=/

This token is further used by next API call (automatically) like:

Request Header:

access-token: iT0VQOmOIn-NcJNGoJ3Qc32iLUnxsyIe3GLexNmtqq6sIiGSEHCCs8unI-m_F_hZsVmwtlLRPx-5zxomc5tusNXDC5I1

enter image description here

As you can see call took really long time to resolve.

Now if I copy the same access-token to the parameters in Postman and run it from my local machine, it's resolved in 732ms

enter image description here

I have no idea why it is like this.

My Angular code:

ngOnInit(): void {
    this.getData().subscribe({
      next: e => console.log(e)
    });
}

getData() {
    return  this.http.post('./api/Portfolio/GetUiData', this.configService.getHeaderParams());
}
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
foo-baar
  • 1,076
  • 3
  • 17
  • 42
  • if you look at the timing of the call in dev tools, where is the time spent? in sending the request? or waiting for the response? it could very well me that a majority of your time is spent waiting for the response, in which case the back end would need to be checked.? – Edward May 28 '20 at 23:42
  • @Edward Yes waiting for the call, but kind of strange the same call with same token in Postman resolves much much faster. – foo-baar May 28 '20 at 23:45
  • 1
    Download wireshark and run two traces, one for your application and the other for postman. One of them is doing something different. – JWP May 29 '20 at 00:37
  • Same issue, could not find any reason so far. I also did a test with a fresh Angular app, it has the same behaviour. So it should be nothing regarding the programming style or similar – btx Oct 31 '22 at 07:27

0 Answers0