System.Web.HttpContext.Current 跟踪分析
public static HttpContext Current
{
get
{
return ContextBase.Current as HttpContext;
}
set
{
ContextBase.Current = (object) value;
}
}
internal class ContextBase
{
internal static object Current
{
get
{
return CallContext.HostContext;
}
[SecurityPermission(SecurityAction.Demand, Unrestricted = true)] set
{
CallContext.HostContext = value;
}
}
[TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
public ContextBase()
{
}
internal static object SwitchContext(object newContext)
{
object hostContext = CallContext.HostContext;
if (hostContext != newContext)
CallContext.HostContext = newContext;
return hostContext;
}
}
public static Object HostContext
{
[System.Security.SecurityCritical] // auto-generated
get
{
Object hC;
IllogicalCallContext ilcc = Thread.CurrentThread.GetIllogicalCallContext();
hC = ilcc.HostContext;
if (hC == null)
{
LogicalCallContext lcc = GetLogicalCallContext();
hC = lcc.HostContext;
}
return hC;
}
[System.Security.SecurityCritical] // auto-generated_required
set
{
if (value is ILogicalThreadAffinative)
{
IllogicalCallContext ilcc = Thread.CurrentThread.GetIllogicalCallContext();
ilcc.HostContext = null;
LogicalCallContext lcc = GetLogicalCallContext();
lcc.HostContext = value;
}
else
{
LogicalCallContext lcc = GetLogicalCallContext();
lcc.HostContext = null;
IllogicalCallContext ilcc = Thread.CurrentThread.GetIllogicalCallContext();
ilcc.HostContext = value;
}
}
}
internal IllogicalCallContext GetIllogicalCallContext()
{
return ExecutionContext.IllogicalCallContext;
}
System.Web.HttpContext.Current 跟踪分析的更多相关文章
- System.Web.HttpContext.Current.Session为NULL解决方法
http://www.cnblogs.com/tianguook/archive/2010/09/27/1836988.html 自定义 HTTP 处理程序,从IHttpHandler继承,在写Sys ...
- 为什么获取的System.Web.HttpContext.Current值为null,HttpContext对象为null时如何获取程序(站点)的根目录
ASP.NET提供了静态属性System.Web.HttpContext.Current,因此获取HttpContext对象就非常方便了.也正是因为这个原因,所以我们经常能见到直接访问System.W ...
- HttpContext为null new HttpContextWrapper(System.Web.HttpContext.Current)
HttpContext = (context == null ? new HttpContextWrapper(System.Web.HttpContext.Current) : context);
- System.Web.HttpContext.Current.Server.MapPath("~/upload/SH") 未将对象引用设置为实例对象
做项目的时候,System.Web.HttpContext.Current.Server.MapPath("~/upload/SH") 获取路径本来这个方法用的好好的 因为需要 ...
- System.Web.HttpContext.Current.Session获取值出错
在自定义类库CS文件里使用System.Web.HttpContext.Current.Session获取Session时提示错误:未将对象引用设置到对象的实例. 一般情况下通过这种方式获取Sessi ...
- System.Web.HttpContext.Current.Session为NULL值的问题?
自定义 HTTP 处理程序,从IHttpHandler继承,在写System.Web.HttpContext.Current.Session["Value"]的时 候,没有问题,但 ...
- .NET System.Web.HttpContext.Current.Request报索引超出数组界限。
移动端使用Dio发送 FormData, 请求类型 multipart/form-data, FormData内可以一个或多个包含文件时. 请求接口时获取上传的fomdata数据使用 System.W ...
- System.Web.HttpContext.Current.Request用法
public static void SetRegisterSource() { if (System.Web.HttpContext.Current.Request["website&qu ...
- 慎用System.Web.HttpContext.Current
每当控制流离开页面派生的Web表单上的代码的时候,HttpContext类的静态属性Current可能是有用的. 使用这个属性,我们可以获取当前请求(Request),响应(Response),会话( ...
随机推荐
- BZOJ 3036 绿豆蛙的归宿
期望dp.类似记忆化搜索的方法实现. #include<iostream> #include<cstdio> #include<cstring> #include& ...
- List<T>Contains, Exists, Any之间的优缺点对比
在List<T>中,Contains, Exists, Any都可以实现判断元素是否存在. 性能方面:Contains 优于 Exists 优于 Any 测试的代码: public sta ...
- Sheet can not be presented because the view is not in a window的解决办法,和window的简单使用
Sheet can not be presented because the view is not in a window,顺便在stackoverflow上找了答案,希望能给大家带来帮助,在此感谢 ...
- 步步入佳境---UI入门(4) --简单练习
一,创建SingleViewApplication 1,UILabel的简单使用 UILabel *label=[[UILabel alloc]initWithFrame:CGRectMake(0, ...
- HDU4897 (树链剖分+线段树)
Problem Little Devil I (HDU4897) 题目大意 给定一棵树,每条边的颜色为黑或白,起始时均为白. 支持3种操作: 操作1:将a->b的路径中的所有边的颜色翻转. 操作 ...
- HDU 1080
http://acm.hdu.edu.cn/showproblem.php?pid=1080 二维最长公共子序列 #include <iostream> #include <cstd ...
- WPF Step By Step 完整布局介绍
WPF Step By Step 完整布局介绍 回顾 上一篇,我们介绍了基本控件及控件的重要属性和用法,我们本篇详细介绍WPF中的几种布局容器及每种布局容器的使用场景,当 然这些都是本人在实际项目中的 ...
- @Html.DropDownListFor 绑定列表项
MVC中为 DropDownListFor 绑定列表项, 一种方案从后台加载列表内容,通过ViewData传递到前台页面. View: <div class="editor-label ...
- Python MySQL ORM QuickORM hacking
# coding: utf-8 # # Python MySQL ORM QuickORM hacking # 说明: # 以前仅仅是知道有ORM的存在,但是对ORM这个东西内部工作原理不是很清楚, ...
- python 怎样使用安装库
win: 1.使用匹配安装 进入pip所在目录C:\Python27\Scripts pip intasll lxml 2.源码下载安装 下载源码,解压到任意目录 cd 进入到setup.py的目录 ...