Here is the property implementation Current:
public static HttpContext Current
{
get
{
return ContextBase.Current as HttpContext;
}
set
{
ContextBase.Current = (object) value;
}
}
And the ContextBase that is used in this property:
internal class ContextBase
{
internal static object Current
{
get
{
return CallContext.HostContext;
}
[SecurityPermission(SecurityAction.Demand, Unrestricted = true)] set
{
CallContext.HostContext = value;
}
}
And CallContext:
public sealed class CallContext
{
public static object HostContext
{
[SecurityCritical]
get
{
ExecutionContext.Reader executionContextReader =
Thread.CurrentThread.GetExecutionContextReader();
return executionContextReader.IllogicalCallContext.HostContext ?? executionContextReader.LogicalCallContext.HostContext;
}
[SecurityCritical]
set
{
ExecutionContext executionContext =
Thread.CurrentThread.GetMutableExecutionContext();
if (value is ILogicalThreadAffinative)
{
executionContext.IllogicalCallContext.HostContext = (object) null;
executionContext.LogicalCallContext.HostContext = value;
}
else
{
executionContext.IllogicalCallContext.HostContext = value;
executionContext.LogicalCallContext.HostContext = (object) null;
}
}
CallContext.HostContext, Thread.CurrentThread , \request.
HttpContext \Controller. , , - , . HttpContext.Current , .