HTTP会话的范围是什么? [英] What is the scope of an HTTP session?

查看:156
本文介绍了HTTP会话的范围是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HTTP会话的范围究竟是什么?

What exactly is the scope of an HTTP session?

我一直在谷歌搜索但似乎无法得到一个直接的答案 - 一个会话应该是在用户关闭浏览器时清除,但我不清楚 - 这是否意味着关闭浏览器窗口或退出浏览器应用程序?同时打开两个浏览器窗口的用户是否维护两个不同的会话?如果同一个会话,浏览器标签是否总是一部分?

I've been googling this but can't seem to get a straight answer- A session is supposed to get cleared out "when a user closes their browser", but that's unclear to me- Does that mean closing the browser window, or quitting the browser application? Does a user with two browser windows open at the same time maintain two different sessions? And are browser tabs always part if the same session?

推荐答案

这取决于您在应用程序中跟踪会话的方式。

This will depend on how you are tracking sessions in your application.

默认情况下,它们由 HttpOnly cookies跟踪。这意味着如果用户关闭当前选项卡,则他不会松开会话。如果他关闭浏览器虽然他会失去会话。

By default they are tracked by HttpOnly cookies. This means that if the user closes the current tab, he doesn't loose the session. If he closes the browser though he looses the session.

如果您使用无cookie模式跟踪会话( cookieless =true),ASP.NET将追加所有网址的自定义标记,表示用户可以在同一浏览器实例的2个不同标签上记录2个不同的会话。

If you use a cookieless mode to track sessions (cookieless="true"), ASP.NET will append a custom token to all urls meaning that a user can be logged with 2 different sessions on 2 different tabs of the same browser instance.

这篇关于HTTP会话的范围是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆