I have a HttpModule in which Autenticate Request event for the custom code to run.It has a static constructor which initializes some values.Also at the start of the event code I check for a spcial page by checking the page name in the URL and if present
I want the code to pass through without proceeding further in the event code.I have 2 questions.
1.The contructor is static so does that mean that it will be called just once unless the app pool or web app is recyled.I am using caching to cache some content which gets initialized in the constructor but since it is not even calling the constructor again
unless I recycle the app pool I m not sure whether caching is of any use here.
2.For the same requests the Init method is called several times for different urls like Images etc.But what I want is as soon as it detects the special it should just move on .
1.The contructor is static so does that mean that it will be called just once unless the app pool or web app is recyled.I am using caching to cache some content which gets initialized in the constructor but since it is not even calling the constructor again
unless I recycle the app pool I m not sure whether caching is of any use here.
Correct.
sharepoint99
2.For the same requests the Init method is called several times for different urls like Images etc.But what I want is as soon as it detects the special it should just move on .
The runtime creates many instances of http modules. This way the runtime can use one http module per thread if multiple requests are being executed. Under the covers these instances are pooled and created/destroyed based upon demand.
sharepoint99
Member
31 Points
33 Posts
The init() being called several times in httpmodule
Aug 27, 2012 07:00 PM|LINK
Hello
I have a HttpModule in which Autenticate Request event for the custom code to run.It has a static constructor which initializes some values.Also at the start of the event code I check for a spcial page by checking the page name in the URL and if present I want the code to pass through without proceeding further in the event code.I have 2 questions.
1.The contructor is static so does that mean that it will be called just once unless the app pool or web app is recyled.I am using caching to cache some content which gets initialized in the constructor but since it is not even calling the constructor again unless I recycle the app pool I m not sure whether caching is of any use here.
2.For the same requests the Init method is called several times for different urls like Images etc.But what I want is as soon as it detects the special it should just move on .
Thanks
BrockAllen
All-Star
27564 Points
4912 Posts
MVP
Re: The init() being called several times in httpmodule
Aug 27, 2012 07:09 PM|LINK
Correct.
The runtime creates many instances of http modules. This way the runtime can use one http module per thread if multiple requests are being executed. Under the covers these instances are pooled and created/destroyed based upon demand.
DevelopMentor | http://www.develop.com
thinktecture | http://www.thinktecture.com/