Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Caching / November 2003

Tip: Looking for answers? Try searching our database.

HttpContext in LDASM

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Alexander Inochkin - 20 Nov 2003 14:27 GMT
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.
Alexander Inochkin - 20 Nov 2003 14:56 GMT
> Hi!
>
[quoted text clipped - 35 lines]
>
> Inochkin Alexander.
MSFT - 21 Nov 2003 08:07 GMT
Hi Alexander,

CallContext is a specialized collection object like a namevaluecollection.
The name is set with SetData Method and we need to use the special name
string when call GetData Method. I haven't read the source code of
system.web.httpcontext, but I think the name may not be "HttpContext" as
sepcified in your code, so that you failed to retireve the object.

Luke
Microsoft Online Support

Signature

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Alexander Inochkin - 21 Nov 2003 08:20 GMT
Thanks for help.

Its true... The name is "HtCt" in v1.1.4322 and was "HttpContext" in
v1.0.3705. So the name was changed. And when I opened the System.Web.dll I
opened the defferent version I used....

Thanks very much...

> Hi Alexander,
>
[quoted text clipped - 10 lines]
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.