了解 ASP.Net 会话生命周期

2

本文介绍了了解 ASP.Net 会话生命周期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我对 ASP 或 ASP.Net 会话生命周期(或生命周期)概念感到困惑.更具体地说,我的困惑是:

I am confused about ASP or ASP.Net session life time (or life cycle) concepts. More specifically, my confusions are:

  1. IIS 如何决定新会话何时开始和现有会话何时结束?特别是当我们调用重定向代码时,IIS如何决定会话是继续还是结束?
  2. 如何设置会话过期时间?(目前我只知道通过web.config sessionState项来设置.)
  3. 一个会话是否可以访问另一个会话的变量?

推荐答案

  1. 会话开始是因为请求不包含会话 cookie,或者它包含的会话 cookie 不再映射到会话.会话以 a) 结束,它处于空闲状态,在超时期间没有进一步的请求引用它.b)它被代码故意中止.c) 进程执行时进程内会话终止,例如当应用被回收时.

  1. Session starts because the request does not contain a session cookie or the session cookie it does contain no longer maps to a session. A session ends by a) it has sat idle with no further requests referencing it for the timeout period. b) Its deliberately aborted by code. c) In-process session dies when the process does, e.g. when the app is recycled.

更改超时的不同方法基本上是修改 web.config 或从其继承值的配置文件.

Different ways to change the timeout are basically modifing the web.config anyway or a config file from which the value is inherited.

除非会话对象被代码故意放置在另一个会话可以访问它的地方.

Not unless the session object is deliberately placed by code somewhere that another session can access it.

这篇关于了解 ASP.Net 会话生命周期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

Func<string,string> 有什么区别?和委托?
What is the difference between Funclt;string,stringgt; and delegate?(Funclt;string,stringgt; 有什么区别?和委托?)...
2023-11-11 C#/.NET开发问题
3

ASP.NET MVC 中的 <%: 和 <%= 有什么区别?
What is the difference between lt;%: and lt;%= in ASP.NET MVC?(ASP.NET MVC 中的 lt;%: 和 lt;%= 有什么区别?)...
2023-11-10 C#/.NET开发问题
0

标签系统的 linq 查询 - 搜索多个标签
linq query for tag system - search for multiple tags(标签系统的 linq 查询 - 搜索多个标签)...
2023-11-10 C#/.NET开发问题
0

论坛标签.实施它们的最佳方法是什么?
Forum tags. What is the best way to implement them?(论坛标签.实施它们的最佳方法是什么?)...
2023-11-10 C#/.NET开发问题
1

html 脚本标签未使用类型 javascript <script type="text
html script tag not using type javascript lt;script type=quot;text/htmlquot;gt;?(html 脚本标签未使用类型 javascript lt;script type=quot;text/htmlgt;gt;?)...
2023-11-10 C#/.NET开发问题
6

ASP.NET 控件到 HTML 标记等效
ASP.NET Control to HTML tag equivalent(ASP.NET 控件到 HTML 标记等效)...
2023-11-10 C#/.NET开发问题
32