Dont use ThreadStatic in ASP.NET

I should have known, and I felt that it was wrong, but recently I used the [ThreadStatic] attribute on a web applications.


I just assumed that because each request has its own thread, the [ThreadStatic] attribute will hold the variable value ONLY during the request processing BUT BUT...

Threads in ASP.NET they live on a ThreadPool and you have no control on the Thread Lifecycle :S

As a workaround you can use something like System.Web.HttpContext.Current.Items