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?
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.
What I'm getting at, is can I use thread static storage?
No. Use the Application/Cache or Session stores instead.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With