Angular 15, dotnet core 7
POSTMAN: does a post of https://localhost:7270/api/Account/login the login parameter is a json with username and password
It runs in the controller just fine and returns correct data.
Angular Typescript creates a loginDto with username and password with identical data as used in POSTMAN, I put a breakpoint in the controller constructor, which is never reached.
Chrome shows the error response is "... Unknown Error". The URL matches what was sent by POSTMAN.
Swagger works fine as well.
How can I debug this error?
***** Updates per your requests ******* Typescript:
export class loginDto
{
public Username!: string;
public Password!: string;
constructor(user: string, password: string)
{
this.Username = user;
this.Password = password;
}
}
*** Calling function:
async loginAsync(userName: string, pass: string) {
this.baseUrl = this.cache.getBaseUrl(); <<--- see below
var dto: loginDto = new loginDto(userName, pass);
this.http.post<UserDto>(this.baseUrl + 'account/login', dto).subscribe({
next: (response: UserDto) => {
this.toastr.success("Logged In Successfully", "", { positionClass: 'toast-bottom-right' });
var username = response.Username;
var token = response.Token;
var knownAs = response.KnownAs;
var roles = "admin"; // add roles when identity is added
this.cache.cacheUser(username, token, roles, knownAs);
this.route.navigateByUrl('/splashPagePost');
},
error: (error) => {
this.toastr.error("Invalid Login", "", { positionClass: 'toast-bottom-right' });
this.cache.setUserLoginStatus('NavVisitor');
this.accountLoginKnown.next('');
this.route.navigateByUrl('/splashPage');
}
}
);
}
*** The baseUrl comes from environment.ts: apiUrl: 'https://localhost:7270/api/'
*** Since you asked me to look at the network, I see more info here:

*** Program.cs
I'm not aware of anything I should put into Angular side for CORS?
***** HERE is the FULL Network screen for this request
***** opening the CORS error line in Network:
This is correct...
**** Opening the Next network line (as shown)



