A
Alexander Inochkin
Hi!
Could you help me to understand next fact...
I open in LDASM System.Web.dll and read:
..method /*060002D7*/ public hidebysig specialname static
class System.Web.HttpContext/* 02000051 */
get_Current() cil managed
// SIG: 00 00 12 81 44
{
// Method begins at RVA 0x20df5
// Code size 16 (0x10)
.maxstack 8
IL_0000: /* 72 | (70)0077F0 */ ldstr "HttpContext" /*
700077F0 */
IL_0005: /* 28 | (0A)00012F */ call object [mscorlib/*
23000001 */]System.Runtime.Remoting.Messaging.CallContext/* 010000E7
*/::GetData(string) /* 0A00012F */
IL_000a: /* 75 | (02)000051 */ isinst
System.Web.HttpContext/* 02000051 */
IL_000f: /* 2A | */ ret
} // end of method HttpContext::get_Current
so I decided that I can get current HttpContext by two ways:
1 -
HttpContext cnt = HttpContext.Current;
2 -
object o =
System.Runtime.Remoting.Messaging.CallContext.GetData("HttpContext");
HttpContext cnt = o as HttpContext;
but in test in second example I get cnt == null....
Question: Why I got different results? What is wrong.
Inochkin Alexander.
Could you help me to understand next fact...
I open in LDASM System.Web.dll and read:
..method /*060002D7*/ public hidebysig specialname static
class System.Web.HttpContext/* 02000051 */
get_Current() cil managed
// SIG: 00 00 12 81 44
{
// Method begins at RVA 0x20df5
// Code size 16 (0x10)
.maxstack 8
IL_0000: /* 72 | (70)0077F0 */ ldstr "HttpContext" /*
700077F0 */
IL_0005: /* 28 | (0A)00012F */ call object [mscorlib/*
23000001 */]System.Runtime.Remoting.Messaging.CallContext/* 010000E7
*/::GetData(string) /* 0A00012F */
IL_000a: /* 75 | (02)000051 */ isinst
System.Web.HttpContext/* 02000051 */
IL_000f: /* 2A | */ ret
} // end of method HttpContext::get_Current
so I decided that I can get current HttpContext by two ways:
1 -
HttpContext cnt = HttpContext.Current;
2 -
object o =
System.Runtime.Remoting.Messaging.CallContext.GetData("HttpContext");
HttpContext cnt = o as HttpContext;
but in test in second example I get cnt == null....
Question: Why I got different results? What is wrong.
Inochkin Alexander.