Greg
Greg

Reputation: 31378

ASP.NET Authentication to use LocalStorage rather than Cookie?

Ignore for the moment that not all browsers support LocalStorage.

Would it be possible to roll your own authentication "handler" (for want of a better word) that makes use of LocalStorage rather than a Cookie for FormsAuthentication within an ASP.NET web app?

If it is possible where would I find the best information to start learning how to do it?

Upvotes: 2

Views: 1021

Answers (1)

Ramesh
Ramesh

Reputation: 13266

Generally, your authentication happens at the server end and cookie contents are passed along with every request. So, by using the information available in request before accessing the resource, server can see if the user is logged in.

But, in case of localStorage the contents are not passed to the server with every request and is accessible only to Javascript. Hence it is not possible to use localStorage for authentication instead of cookie.

Upvotes: 4

Related Questions