Link data to a stream: how do you do it?

When writing some aysnc controllers in ASP.NET MVC2, I came across a situation where I had to call AsyncManager.Sync. I became interested:

When do I get HttpContext.Currentwhat happens? How does ASP.NET know what HttpContextI need? How is the current context associated with this thread and how is it retrieved?

+3
source share
1 answer

Thread- bound storage is used, this is called Thread Local Storage .

, , , . , HttpContext.Current TransactionScope. "" , . \ .

TLS, ThreadStaticAttribute Thread.SetData\GetData.

+4

Source: https://habr.com/ru/post/1777800/


All Articles