In production mode I have the angular 5 client and the web api on the same site so I have no problem with the session but in development mode my angular 5 is hosted on localhost:4200 which reset the session on each call to a service.
I can host the angular 5 and the web api on the same host on development mode but it means I have to do ng build all the time(which will have a big overhead).
Any ideas? Should I use the session? or there is a better way?
update
First of all just like Andrei Dragotoniu said the use of session in the web api is not best practice and should be avoided.
But if the web api must use the session I have found the solution for the development mode - add a proxy to the angular 5 project: I had to proxy my requests to my web api server and than the requests to the web api and the web api are is the same domain.
how to add a proxy to the angular 5 project:
angular-cli server - how to proxy API requests to another server?