There is no inherent reason that multiple calls for the same request must be made on the same thread, but it might not happen unless you have a heavily loaded web server. It should not matter to you (except as a matter of curiosity) whether multiple threads could be used to handle a single request; you should not be doing anything that would break if it happened, and AFAIK there is no reason to do so.
The apparent intent of the designers is that you use the Items property of the HttpContext object to store any state you need during execution of the request. In what class had you planned to use ThreadStatic variables? Even if all the calls for a particular request were guaranteed to be made on the same thread (and they're not), there could be calls made on that same thread for a new request before all calls for an earlier request had been completed. The ASP.NET infrastructure was designed to support more simultaneously executing requests than there are threads -- using ThreadStatic variables just isn't appropriate. At 06:16 AM 4/23/2004, Angel \"Java\" Lopez wrote: >Hi people! > >A big question for me: > >What is the behaviour of ThreadStatic variables on an ASP.NET Request? >Can I trust that if I set a value on such variable, the value (and the >thread) is the same for all the request (that is, from BeginRequest to >EndRequest)? > >I think that this is the case, but some article: > >http://scottwater.com/blog/archive/2003/05/23/7463.aspx >http://radio.weblogs.com/0106747/2003/05/23.html#a320 > >suggests that not. > >Yes, I can use HttpContext, but, I´m curious about the ASP.NET thread pool >behaviour. > >If I cannot use securely a ThreadStatic variable during an ASP.NET request, >then I ask: > >- This behaviour is extended on any application that uses the automatic >thread pool? Or it is a particular behaviour of the ASP.NET thread pool? > >I apologize some bad english... Me Tarzan... :-) > >TIA > >Angel "Java" Lopez >http://www.ajlopez.com/ J. Merrill / Analytical Software Corp =================================== This list is hosted by DevelopMentorŽ http://www.develop.com Some .NET courses you may be interested in: NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles http://www.develop.com/courses/gaspdotnetls View archives and manage your subscription(s) at http://discuss.develop.com