Asp.Net HttpApplication请求管道与Session(一)
1.请求处理顺序执行事件
/********************请求处理顺序执行事件**********************/
/// <summary>
/// 请求入站
/// 在此管道中禁止访问Session
/// </summary>
protected void Application_BeginRequest()
{
Response.Write("----BeginRequest---");
Response.Write("<br/>");
}
/// <summary>
/// 发送内容到客户端之前
/// 此管道中禁止访问Session
/// </summary>
protected void Application_PreSendRequestContent()
{
Response.Write("----PreSendContent---:");
Response.Write("<br/>");
}
/// <summary>
/// 页面框架执行
/// 此管道中可以访问Session
/// </summary>
protected void Application_PostRequestHandlerExecute()
{
Response.Write("----PostRequestHandlerExecute---count:" + Session.Count + ",当前SessionID:" + Session.SessionID);
StringBuilder builder = new StringBuilder();
Response.Write("<div style='text-indent:2em;'>");
foreach (string item in Session.Keys)
{
string line = string.Format("---{0}:{1}", item, Session[item]);
builder.AppendLine(line);
}
Response.Write(builder.ToString());
Response.Write("</div>");
Response.Write("<br/>");
}
/// <summary>
/// 页面框架释放请求状态
/// 此管道中禁止访问Session
/// </summary>
protected void Application_ReleaseRequestState()
{
Response.Write("----ReleaseRequestStatet---");
Response.Write("<br/>");
}
/// <summary>
/// 页面框架响应完成
///此管道,禁止使用Session
/// </summary>
protected void Application_UpdateRequestCache()
{
Response.Write("----UpdateRequestCache---");
Response.Write("<br/>");
}
/// <summary>
/// 请求出站
/// 此管道中禁止访问Session
/// </summary>
protected void Application_EndRequest()
{
Response.Write("----EndRequest---");
Response.Write("<br/>");
}
没有添加Session数据前访问:

添加Session 数据后访问:

更多:
Asp.Net HttpApplication请求管道与Session(二)
Asp.Net HttpApplication请求管道与Session(一)的更多相关文章
- Asp.Net HttpApplication请求管道与Session(二)
Asp.Net 回话的创建与结束 LogHelper.LogHelper _log = new LogHelper.LogHelper(); /// <summary> /// 程序开始- ...
- ASP.NET MVC5请求管道和生命周期
请求处理管道 请求管道是一些用于处理HTTP请求的模块组合,在ASP.NET中,请求管道有两个核心组件:IHttpModule和IHttpHandler.所有的HTTP请求都会进入IHttpHandl ...
- asp.net的请求管道事件
一.引言 上篇介绍了Http的请求过程提到了在请求进入到创建完 HttpApplication 对象后,将进入一系列的处理事件Event,那么这些事件具体都有哪些呢,这篇文章就来简要阐述一下. 二.正 ...
- Asp.Net 拦截请求自定义处理
需求: 在Aps.Net 应用中,对于浏览器请求的部分url的地址自定义处理,不交给路由系统或页面. 解决方案: 在全局文件Global.asax中 ,提供Application_BeginReque ...
- ASP.NET网页请求以及处理全过程(反编译工具查看源代码)
本文是自己查看源码后的个人总结,不保证其准确性.大家可作为参考. 浏览器和服务器之间的通信. 当敲一个域名到浏览器上面,然后回车的时候,如:http://www.baidu.com/index.asp ...
- 跟我一起学.NetCore之中间件(Middleware)简介和解析请求管道构建
前言 中间件(Middleware)对于Asp.NetCore项目来说,不能说重要,而是不能缺少,因为Asp.NetCore的请求管道就是通过一系列的中间件组成的:在服务器接收到请求之后,请求会经过请 ...
- 13、ASP.NET MVC入门到精通——MVC请求管道
本系列目录:ASP.NET MVC4入门到精通系列目录汇总 ASP.NET MVC的请求管道和ASP.NET请求管道基本上一模一样,如果你对ASP.NET请求管道十分熟悉的话,你只要关注一下不同点.看 ...
- ASP.NET MVC5 的请求管道和运行生命周期
https://www.jianshu.com/p/848fda7f79e0 请求处理管道 请求管道是一些用于处理HTTP请求的模块组合,在ASP.NET中,请求管道有两个核心组件:IHttpModu ...
- ASP.NET MVC入门到精通——MVC请求管道
https://www.cnblogs.com/jiekzou/p/4896315.html 本系列目录:ASP.NET MVC4入门到精通系列目录汇总 ASP.NET MVC的请求管道和ASP.NE ...
随机推荐
- 服务器上开启远程sqlserver小细节
之前按网络上过程配置完成后,连接都很正常.今天看的时候,突然就连接不上了.弄了半天,终于知道问题在哪里了.
- C#生成高清缩略图
/// <SUMMARY> /// 为图片生成缩略图 /// </SUMMARY> /// <PARAM name="phyPath">原图片的 ...
- 成员函数的const不能被修改,包括指针
#include <iostream> class A { private: std::string a; public: A(std::string b) :a(b){} const c ...
- poj2932 Coneology (扫描线)
转载请注明出处: http://www.cnblogs.com/fraud/ ——by fraud Coneology Time Limit: 5000MS Memory Lim ...
- bootstrapValidator Maximum call stack size exceeded
既然validator依赖与Bootstrap3,那么表单必须使用Bootstrap的类来编写. Tip1:如果表单不是通过Bootstrap构建(即元素包含表单项且关联的label没有form-gr ...
- Ubuntu-Java-Scala-Spark-IEDA-configure
最近要接触数据分析,需要快速入门,就想在Ubuntu下配置IDEA和Spark编程环境. 1.下载jdk #java /etc/profile .zshrc, 或者直接在终端输入export JAVA ...
- AFNetworking使用总结
AFNetworking使用总结 关于AFNetworking使用总结 以及一些错误的解决办法. AD:WOT2015 互联网运维与开发者大会 热销抢票 AFNetworking使用总结 分享类型 ...
- Android数据存储
SharedPreferences----------->for primitive data Internal Storage-------------->for private dat ...
- Java日志最佳实践
http://www.ibm.com/developerworks/cn/java/j-lo-practicelog/
- WCF 基于Cookie的登录验证回传问题的解决
参考资料: http://www.cnblogs.com/czcz1024/p/3333138.html http://megakemp.com/2009/02/06/managing-shared- ...