Save User Session/Cookie when logging in

Asked

Viewed 1,018 times

1

In WEB applications usually on the Login screen has the option Remind me, in this application will save user data once the same leave marked the option.

So when the user enters the site again, instead of going to the Login screen, it will go straight to the application’s home screen, no need to log in again.

Reading some forums I saw something related to Cookies and Session user. However, it is not clear to me how this process is done.

1 - Take the Session user means what?

2 - The implementation of Cookies means what?

3 - The 2 cases interact to validate/record user access, no needing to perform a new access?

1 answer

1


1 - Session means you store data during user activity on your site, and it will expire when it leaves or after a certain downtime. This information is available anywhere in the application in the backend.

In the case of ASP.Net MVC with IIS, the most common Session mode is Inproc which causes this data to be stored in the server memory.

In ASP.NET Core, Session is created by using cookies to maintain this information.

2 - Cookies are information stored in the browser, where it can be accessed both in the backend and in the frontend, depending on the configuration. This information is routed across all requests because HTTP is a stateless protocol and also has an expiration date.

3 - In your case, to keep the user logged in, the best option is to use cookies. You can create a cookie, identifying the user, determining the validity and the next time they access your site through the same browser, you identify the existence of this cookie and perform the necessary treatments to re-authenticate the user.

As a suggestion, you can take a look here, which talks more about authentication with cookies

Browser other questions tagged

You are not signed in. Login or sign up in order to post.