I'm just wondering if the same thread is used for each session, or if its dangerous to count on a particular thread between requests. What I'm getting at, is can I use thread static storage?
+7
A:
The short answer is yes. The thread used for a request is returned to the thread pool and can be used to service other requests. They are NOT session specific, and to answer your second question, you should never count on a particular thread being available for subsequent requests on a particular session. Because of this, it is a very bad idea to use thread static variables in ASP.Net.
Kilhoffer
2008-10-15 14:08:46
+1
A:
What I'm getting at, is can I use thread static storage?
No. Use the Application/Cache or Session stores instead.
Oli
2008-10-15 14:15:21
A:
What I'm getting at, is can I use thread static storage?
Or if you only want the data to stay around for the lifetime of a single request, you can store it in HttpContext.Current.Items
mike nelson
2009-03-16 09:57:07