Connecting Tech Pros Worldwide Forums | Help | Site Map

concurrency question on HttpApplication,HttpModule, and Page

walter
Guest
 
Posts: n/a
#1: Apr 25 '06
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.

Teemu Keiski
Guest
 
Posts: n/a
#2: Apr 25 '06

re: concurrency question on HttpApplication,HttpModule, and Page


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

--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke

"walter" <wwu@morneausobeco.com> wrote in message
news:DB19DD96-A83A-4507-BD81-186FEE0AF191@microsoft.com...[color=blue]
> 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.[/color]


walter
Guest
 
Posts: n/a
#3: Apr 25 '06

re: concurrency question on HttpApplication,HttpModule, and Page


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 ?

"Teemu Keiski" wrote:
[color=blue]
> 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
>
> --
> Teemu Keiski
> ASP.NET MVP, AspInsider
> Finland, EU
> http://blogs.aspadvice.com/joteke
>
> "walter" <wwu@morneausobeco.com> wrote in message
> news:DB19DD96-A83A-4507-BD81-186FEE0AF191@microsoft.com...[color=green]
> > 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.[/color]
>
>
>[/color]
Closed Thread