C#Javascript Session Storage - Stack Overflow

if I add a sessionStorage item via javacrript, is it possible to get that keyvalue server side using c

if I add a sessionStorage item via javacrript, is it possible to get that key/value server side using c#.

for example:

Javascript

sessionStorage.setItem("myItem");

Confirm its stored by calling 'sessionStorage.length' in browser console. Returns 1.

C#

Session.Keys.Count; // returns 0

if I add a sessionStorage item via javacrript, is it possible to get that key/value server side using c#.

for example:

Javascript

sessionStorage.setItem("myItem");

Confirm its stored by calling 'sessionStorage.length' in browser console. Returns 1.

C#

Session.Keys.Count; // returns 0
Share Improve this question asked Mar 25, 2015 at 19:42 ManxJasonManxJason 94013 silver badges34 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 6

No, the web server will not have any knowledge of the browser's sessionStorage. The browser's 'session' is pletely isolated from the web server's 'session'.

Depending on what type of information you're looking to store and share, you could use cookies. Cookies will be available to both the browser and the web server. Just remember cookies are transmitted both directions with every request so they can add to the cost of each web request.

Alternatively, you could post the new information to an API. This will add an upfront cost but will reduce the cost of each individual web request. This approach assumes the values being posted to the API change less frequently than the number of times the user changes pages.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744347272a4569759.html

相关推荐

  • C#Javascript Session Storage - Stack Overflow

    if I add a sessionStorage item via javacrript, is it possible to get that keyvalue server side using c

    7天前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信