V
V
Vyacheslav Shabunin2021-06-21 19:57:30
ASP.NET
Vyacheslav Shabunin, 2021-06-21 19:57:30

How to use sessions in in ASP.Net Core Web.api + react application?

Hello. I have a question about sessions. If backend is REST architecture and front is js. Where to initialize sessions? If you can use sessionStorage on js, but they say it's not right to do so. Then it turns out it needs to be done in the backend? If so, then how to track them, constantly send a get request?
That is, it turns out that in order to interact with the session, you need to constantly use ajax, as for me sessionStorage is much cheaper to use ... Tell me
how it's done in general, I used to work only with WebForms and mvc, and I'm just now starting to study React

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vasily Bannikov, 2021-06-21
@fleshherbal

If you can use sessionStorage on js, but they say it's not right to do so.

Who is speaking? And in what situation is it wrong? If you store only client data, such as a basket, then you can also store it in local / session storage
If so, then how to track them, constantly send a get request?

When you make a request to the server, some identifier is put into the request, by which you can distinguish one client from another. The same session id. On it it is already possible to pull out any saved data from the database.
That is, it turns out that in order to interact with the session, you need to constantly use ajax, as for me sessionStorage is much cheaper to use ...

If it is safe to use session storage in your situation, then use it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question