Timsen
Timsen

Reputation: 4126

Angular session object with MVC web Api

I am trying to create and maintain a Session while user is using an app, Angular side is pretty simple, i just can create a service which are going to contain Session data unless user choose to refresh where by data will be lost. like here: Maintaining Session through Angular.js

Since MVC web api is restfull, session will always be null (unless using some hacks like here: ASP.NET Web API session or something?, which i dont want to). Do i have to create a separate session table in DB and maintain it on user loggin/logout? or what would be the angular way to do it right?

Upvotes: 0

Views: 1833

Answers (1)

Maurice
Maurice

Reputation: 27632

Why send the state all the way to the server. Instead you can save it in either window.sessionStorage or window.localStorage if you want things to persist over a browser restart.

Upvotes: 1

Related Questions