DCSIMG
Why is this ThreadStatic member not null ?!?! - Sig-

Sig-

Code and stuff.

Why is this ThreadStatic member not null ?!?!

Well, I used to slap the “[ThreadStatic]” attribute on static members that I wanted to be Unique to the current request (null at the start of next one).

It seems that, logically enough – it doesn’t really work that way.
Since ASP.Net uses a threadPool, several consecutive requests may be served by the same thread, and all of your nice decorated members aren’t really unique at all.
(Makes sense, but I never really gave it any thought)

There is a solution – Here’s an article that explains the entire issue :

http://www.hanselman.com/blog/fromradio.ashx?external_referrer=&url=http://radio.weblogs.com/0106747/2003/05/23.html

 

פורסם: Dec 20 2007, 05:21 PM by silver83 | with no comments
תגים:
שלח תגובה

(שדה חובה)  

(שדה חובה)  

(אופציונלי)

(שדה חובה) 

Please add 3 and 3 and type the answer here:


Enter the numbers above: