Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to access html 5 localstorage asp.net mvc 3 controller/pipleline

I am currently setting/getting localstorage values via javascript which works fine. However I would like to get the values out of localstorage in my controller or somewhere else in the request pipeline via server side code. (Similar to how the Request.Cookies comes back from the HttpContext)

Does anyone know where the localstorage is hidden? I can see it in firebug/chrome so I know its set fine and I can pull it out via javascript.

like image 418
ElvisLives Avatar asked Oct 25 '11 16:10

ElvisLives


People also ask

How does controller get localStorage value?

You can get/set the localStorage value by using the getItem / setItem method in the window. localStorage .


1 Answers

localStorage remains on the client side, and is not transferred in the request.

If you want to transfer any localStorage information to the server, you will need to get the values you want, and then either place them into hidden fields on your form, or use some other means (such as JSON) to transfer the values to the server.

like image 134
counsellorben Avatar answered Sep 21 '22 15:09

counsellorben