473,396 Members | 1,834 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Static Field in IHttpModule

I have a class that implements IHttpModule to handle URLs with a "RESTful"
nature. It handles them according to a custom configuration section in the
website's Web.Config file. My questions are:
1. Does each client call result in a new instance of my IHttpModule class
being created?
2. Is it better to re-read my custom configuration each time or to add a
static member field containing my class that inherits from
ConfigurationSection so that configuration is always available to the
IHttpModule? Would this be faster at all?
3. If I DO end up creating a static member field (it IS better) will this
affect scalability or cause the site to be somehow stateful instead of
stateless?

Thank you,
Sammy

Sep 18 '06 #1
1 1960
Hi,

Osama Sayed wrote:
I have a class that implements IHttpModule to handle URLs with a "RESTful"
nature. It handles them according to a custom configuration section in the
website's Web.Config file. My questions are:
1. Does each client call result in a new instance of my IHttpModule class
being created?
According to this page and others I read, it doesn't.
http://www.devx.com/vb2themax/Article/19901/0/page/2

The instance will be created on the first call to dynamic content in the
application (ASPX, ASMX...) and will then "filter" every request going
to this web application.
2. Is it better to re-read my custom configuration each time or to add a
static member field containing my class that inherits from
ConfigurationSection so that configuration is always available to the
IHttpModule? Would this be faster at all?
Obviously, avoiding to re-read the configuration file is faster. The
question is: How much faster, and what problems does it cause if you
cache it.

For example, can the configuration change during run time? If yes, how
do you manage the differences between the cache and the file? Who's in
charge of deleting the cache, and when? Etc... These are all design
questions that may influence the implementation.
3. If I DO end up creating a static member field (it IS better) will this
affect scalability or cause the site to be somehow stateful instead of
stateless?
If you cache something, your application will be stateful. However, I
believe that while web sites may be stateless, web applications are
mostly stateful. If it's managed correctly, it shouldn't be a problem.
>
Thank you,
Sammy
HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch
Sep 18 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: moid | last post by:
Sir we are implementing front controller in asp.net. we implement three event-handler 1. PreRequestHandlerExecute 2. PostRequestHandlerExecute 3. BeginRequest we just want to initialize...
2
by: Kenneth Myhra | last post by:
Hi, We have been trying to develop an IHTTPModule (that was supposed to replace or take over the ISAPI Filters, as far as we know). We have developed one in C# and it seems to be working. The...
2
by: Kenneth Myhra | last post by:
Hi all, We are trying to make an ISAPI Filter, in .NET by implementing the IHttpModule interface, that will authorize the request for certain binary file types (GET), this is working fine. But we...
5
by: Andrew Lippitt | last post by:
What gaurantees are there in the way of which thread the events are called from. I've seen: Thread A Begin Thread B Begin Thread A End Thread A End That seems to indicate that Begin and End...
6
by: Andy G | last post by:
I am trying to implement the global error handling described on this page... http://www.dotnetdevs.com/articles/GlobalErrorHandling.aspx I'm a VB person and don't understand much of C# when it...
6
by: Simone Busoli | last post by:
Hello, I am trying to understand when IHttpModule.Dispose method is called. Is it called when the Application is disposed, or when the request ends? If I want to make an object Application-wide...
5
by: Richard | last post by:
I've developed a small ASPX template framework (based on Chun Li's article on CodeProject: http://www.codeproject.com/aspnet/headerfooter.asp#xx849313xx) which uses a IHttpModule to apply...
8
by: =?Utf-8?B?UGhpbGlw?= | last post by:
When is the IHttpModule Dispose driven ?....at application recycle time ? I developed a test HttpModule to trace INIT, BeginRequest, EndRequest and Dispose....and the Dispose never gets driven. ...
1
by: Eric Goforth | last post by:
Hello, I found a C# example on the web that used an httpmodule. I've translated it to VB.NET and the website compiles fine, but when I build the website the iHttpModule doesn't compile, I can't...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.