Is it possible to set localStorage or Session variable in asp.net page and read it in javascript on the other page?

后端 未结 5 1344
囚心锁ツ
囚心锁ツ 2020-12-19 07:45

As in question. Is it possible to set variable in asp.net page in localStorage and retrieve it on the other page?

How to set localStorage variable in asp.net. Is it

5条回答
  •  情深已故
    2020-12-19 08:19

    I guess You can't. The whole point of local storage is that it is local and You can manipulate it only from javascript. If You need to pass values between server and client You need to use some transport technology - cookies, ajax calls, hidden fields etc. It will all depend on how your application is organized, what kind of information is being stored, its volume, whether you want to redirect or not, but in all cases this should be done using javascript since that's the only way to access data stored in localStorage.

提交回复
热议问题