Goor Lavi Goor Lavi - 2 years ago 123
AngularJS Question

Website hold user details

Using angularjs in the client , and c# in the server side.
I want to learn how can i create a website with users.

I know how to store the data in the db.

My real question is how the site remember the user session
After refreshing.
So the user dont need to login again.

Thanks guys.

Answer Source

Microsoft created a JWT (JSON Web Token) package for .NET Web API projects specifically for this purpose. And since you're using Angular.js, working with JSON is perfect.

There are plenty of tutorials for understanding how JWT works and securely saves a user's session like this one:

The idea is that your server sends your client/user a long encrypted string. The client saves it in their cookies and sends it to your server whenever you want to verify the user.

Most of the complicated details regarding encryption you don't need to worry about. Just follow the tutorials for setting up the exchange of the JWT tokens.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download