Posted on 22/05/2015 10:41:51
Hi Dmitrij,
It can of cause be done, however there exists no automated functionality as there is with Cookies. Cookies are always send back and forth the client and the server, browser localstorage is not. I actually just the other day was thinking about such a setup. I have not googled it, but I guess that "someone outthere" have already created some code to handle it.
What is needed?
You need some code i .NET to handle such a setup, some C# code to support sending serialized data to the client, and to receive the data too.
The client also needs "to do something". When it posts data to the server a layer in javascript should pickup, and serialize (JSON.stringify) the data stored in the localstorage. It also needs to be able to receive JSON data in response and parse it through to the browser data layer (localstorage).
These tasks could be first started up by making a test where you define say 4 types of data you wish to exchange between server and server.
I know that this reply is not a solution, however I hope that you can find some value in it. You are welcome to contact me, should you wish to discuss it further. Also I would like to mention something from the outside of the Dynamicweb and .NET world: Meteor. Meteor is a very interesting platform which is coded in javascript, and they have invented their own protocol which can do amoung other instant client-server data binding! It sounds wild, but any data on any client can be dynamically replicated without having to code extra code. To my my note more that just empty words, I would like to share a site I have build (as a hello-world) in Meteor. It is a "leaderboard" where you get to login (Use: test@test.com
/testtest
) and then can give and take points, plus add your own user. Should you choose to visit the site, I will be there and you will see how any change done in any browser anywhere will be dynamically reflected across all visitors, simply by coding this in javascript in Meteor! :-) Here goes: https://netsi1964.meteor.com/
Have a great week-end.
/Sten Hougaard
Twitter: @netsi1964
#hireMe - I am looking for a new job, so if you need an experienced front-end developer, please contact me: netsi1964@gmail.com