473,797 Members | 2,934 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
ConfigurationSe ction 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 1978
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
ConfigurationSe ction 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
1174
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 the page, but dont want to load it. After BeginReq the page should Load. becuse we need to fill Datagrid through Command
2
2377
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 problem is that it is not working as it is supposed to work and we *need* to debug it. We made a search on MSDN already. Either my search keywords were irrelevant (we used <IHTTPModule debug> and <IHTTPModule debugging>, without the greater and...
2
1655
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 also want it to authorize the upload of binary files (PUT), The problem with the PUT-scenario is that the file is *not* uploaded when its extension *is* mapped up in IIS, by mapped up I mean the Application Mappings displayed when clicking on the...
5
2366
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 can't be assumed to be called from the same thread, but can I assume that the Begin will happen on the same thread that executes the request?
6
1400
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 gets more complicated. Can someone please help me with the following statement that is in C#, I need this in VB and have been using Patel's converter but just can't get rid of the errors in VS.NET. void IHttpModule(HttpApplication application) {...
6
4183
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 and close it when the application ends can I use that method or write something like this in the class that implements the IHttpModule? public void Init(HttpApplication application) { application.Disposed +=new...
5
2185
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 usercontrols (e.g. header and footer) on pages. The module determines if templates should be added to the page using Page.Request.Path. It matches the current adress to settings found in a configuration-file... It works like a charm except for one...
8
2927
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. After a while the INIT is redriven however the Dispose was never driven. I am trying to locate the best means to hook ASP.NET application recycling ...... Is IHttpModule Dispose a solution for this and if so how ?...... or should I use...
1
1467
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 figure out why. I do have the following entry in my web.config file: <system.web><httpModules><add name="MyModule" type="MyModule.MyModule"/ My iHttpModule Class implements iHttpModule (of course). I also have
0
9536
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10468
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10245
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7559
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6802
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5582
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4131
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3748
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2933
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.