bobek
bobek

Reputation: 8022

using HTML5 session storage in asp.net mvc3

Explanation of the problem:

Right now my asp.net mvc 3 application is using cookieles="auto" setting which I really hate and I am trying to find something that will allow me to turn that feature off.

So I came across HTML5 storage solutions and I am having some trouble understanding the idea behind it. So basically all I need to do is take my userID variable and move it from one page to another and then on the backend I pull out this userID and pass data to view as a model. Now, how can I do it without cookies and using HTML5 storage? If it's only accessible via JavaScript do I need to pass it via ajax to my controllers? But I don't see any sense in this since I already passed my model to the view with empty userID because the cookie was empty.

Is there a way to access the HTML5 storage in the backend? Maybe I am missing something here, please advise!

Upvotes: 0

Views: 2068

Answers (1)

kirilloid
kirilloid

Reputation: 14304

No, there's no way except javascript code, which will read storage content and send it to backend. For small portion of data, which should be available to the server, use cookies.

Local storage was created specially for content, which will not be transfered to the server with each request and therefore allowing to store more data, than cookies w/o traffic spoiling.

Upvotes: 1

Related Questions