concurrency question on HttpApplication,HttpModule, and Page

G

Guest

Hi there, I know there is pool of HttpApplications, and for each request
coming in, HttpRuntime will dedicate one from pool to serve the request. My
questions are :
1. since HttpModule is plug into the process, does each instance of
HttpApplication keep its own set of HttpModule instance or HttpModules are
shared among all HttpApplication instances?

2. In case of HttpApplication keep its own set of HttpModule, does the
HttpModule collection get created for each request or just once and reusable
later for all the following request? In the latter case , we need to handle
the class level field carefully.

3.When I have a particular web folder which need a additional set of
HttpModule, I guess I can add them into the Web.Config within that folder.
But is ASP.NET smart enough to remove them when the request is for the other
folders?

4. Last one is whether Page object is pooled in ASP.NET. I guess the answer
is no.
 
T

Teemu Keiski

Hi,

1. Each instance has its own set of HTTP Modules. HTTP modules are set up so
that they listen events thrown by HttpApplication

2. They are reused (created once per HttpApplication)

3. Settings in web.config are inherited, so if it is a root folder where
modules are set,subfolder uses the same set, unless overridden in sub-
web.config

4. This is determined by Page's IHttpHandler.IsReusable property, which, by
default, is false (it was once commented by MS guys, that making a class
which would be reusable in this case, would take extreme care by the
developer so that it would really be cleared at the end of every request, so
it really is easier to let it recreate instances.) In case you need
performance, or it sucks, then develop your own HTTP handler

Good resource: http://msdn2.microsoft.com/en-US/library/ms178473.aspx
 
G

Guest

Hi Teemu, your answer is great. The only one is the Web.Config question. My
question is the reverse-- Sub folder need the httpmodule , but root/other
folders do not. Wondering if asp.net can maintain the httpmodule list
properly in this case.

Any idea ?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,120
Latest member
ShelaWalli
Top