473,756 Members | 3,211 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

HTTP handlers - Maintaining global objects, and multi-threading

I have an environment with many thousands of client machines uploading
data files several times each day to a web server via HTTP PUT.

To avoid disk I/O (for performance), I am implementing a HTTP handler
to intercept and process incoming data without touching the disk. I
cannot detect PUT requests with my handler (don't know if this is even
supported), so I'm redirecting all requests to the handler as POST
using an ISAPI filter.

I wish to share LDAP and SQL connections across multiple requests (for
performance). Is it possible to maintain global objects in a HTTP
handler (equivalent to global.asax in web applications)?

Files are uploaded through a tree hierarchy, and at the top-level only
a handful of machines upload the files to the topmost web server. I
have no control over these machines, which upload files one at a time.
So I need a way to complete the HTTP request (so the next file can
begin uploading), before the content has been processed. If I create a
new thread from ProcessRequest( ) to do the processing, and return from
ProcessRequest( ), will this:
a) Terminate the new thread - bad
b) Trigger the next HTTP request, but keep the new thread running
c) Wait for the new thread to terminate before triggering the next
HTTP request

Any help is greatly appreciated.

Cheers,
Chris Hughes
Nov 17 '05 #1
5 2005
System.Web.UI.P age is the default HttpHandler for ASP.Net. When you create
an HttpHandler, you are substituting your class for the Page class as the
handler for the request types you specify. As such, you certainly do have
access to all the elements that System.Web.UI.P age has access to, as your
Handler is also running under ASP.Net, and works within the same HttpContext
that a Page class does. In fact, you can use a global.asax file in your app
as well, and access the Application, Cache, and Session, just as you would
with a Page.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
Neither a follower nor a lender be.

"Chris Hughes" <Ch**********@m anagesoft.com> wrote in message
news:77******** *************** ***@posting.goo gle.com...
I have an environment with many thousands of client machines uploading
data files several times each day to a web server via HTTP PUT.

To avoid disk I/O (for performance), I am implementing a HTTP handler
to intercept and process incoming data without touching the disk. I
cannot detect PUT requests with my handler (don't know if this is even
supported), so I'm redirecting all requests to the handler as POST
using an ISAPI filter.

I wish to share LDAP and SQL connections across multiple requests (for
performance). Is it possible to maintain global objects in a HTTP
handler (equivalent to global.asax in web applications)?

Files are uploaded through a tree hierarchy, and at the top-level only
a handful of machines upload the files to the topmost web server. I
have no control over these machines, which upload files one at a time.
So I need a way to complete the HTTP request (so the next file can
begin uploading), before the content has been processed. If I create a
new thread from ProcessRequest( ) to do the processing, and return from
ProcessRequest( ), will this:
a) Terminate the new thread - bad
b) Trigger the next HTTP request, but keep the new thread running
c) Wait for the new thread to terminate before triggering the next
HTTP request

Any help is greatly appreciated.

Cheers,
Chris Hughes

Nov 17 '05 #2
"Chris Hughes" <Ch**********@m anagesoft.com> wrote in message
news:77******** *************** ***@posting.goo gle.com...
I have an environment with many thousands of client machines uploading
data files several times each day to a web server via HTTP PUT.

To avoid disk I/O (for performance), I am implementing a HTTP handler
to intercept and process incoming data without touching the disk. I
cannot detect PUT requests with my handler (don't know if this is even
supported), so I'm redirecting all requests to the handler as POST
using an ISAPI filter.
I don't know why you wouldn't be able to get PUT requests. Did you specify
PUT as a verb in the <httpHandler> element in web.config?
I wish to share LDAP and SQL connections across multiple requests (for
performance). Is it possible to maintain global objects in a HTTP
handler (equivalent to global.asax in web applications)?
Sure. Just keep the globals in static (Shared in VB) class members. But
you'll have to synchronize access to them, of course. "lock
(typeof(MyHandl er))" should do it.
Files are uploaded through a tree hierarchy, and at the top-level only
a handful of machines upload the files to the topmost web server. I
have no control over these machines, which upload files one at a time.
So I need a way to complete the HTTP request (so the next file can
begin uploading), before the content has been processed.


It sounds like you need an asynchronous HTTP Handler. Look up
IHttpAsyncHandl er in the documentation.
--
John Saunders
Internet Engineer
jo***********@s urfcontrol.com
Nov 17 '05 #3
Thanks for the feedback, John. Very helpful.
To avoid disk I/O (for performance), I am implementing a HTTP handler
to intercept and process incoming data without touching the disk. I
cannot detect PUT requests with my handler (don't know if this is even
supported), so I'm redirecting all requests to the handler as POST
using an ISAPI filter.


I don't know why you wouldn't be able to get PUT requests. Did you specify
PUT as a verb in the <httpHandler> element in web.config?


I set verb="*". I did some searching, and machine.config configures
only HttpGet, HttpPost and HttpSoap requests by default. The
documentation states that this is not extensible for now.

I was told by a Microsoft rep that I can access the data through an
ISAPI extension by using an ISAPI filter to change the HTTP header
from PUT to POST. However, my testing has found that an HTTP handler
does not recognise these changes, and that I might need to use an
ISAPI extension instead, which would be unfortunate.

Any ideas how I might get around this? Is the HTTP handler loaded
before the ISAPI filter is able to change the HTTP header?

Cheers,
Chris Hughes
Nov 17 '05 #4
"Chris Hughes" <Ch**********@m anagesoft.com> wrote in message
news:77******** *************** ***@posting.goo gle.com...
Thanks for the feedback, John. Very helpful.
To avoid disk I/O (for performance), I am implementing a HTTP handler
to intercept and process incoming data without touching the disk. I
cannot detect PUT requests with my handler (don't know if this is even
supported), so I'm redirecting all requests to the handler as POST
using an ISAPI filter.


I don't know why you wouldn't be able to get PUT requests. Did you specify PUT as a verb in the <httpHandler> element in web.config?


I set verb="*". I did some searching, and machine.config configures
only HttpGet, HttpPost and HttpSoap requests by default. The
documentation states that this is not extensible for now.


You may have misunderstood. "HttpPost" has to do with Web Services. verb="*"
should work. Give it a try. You'll also have to configure IIS to pass that
verb to your handler. Click "Configurat ion" on the Home Directory tab.
--
John Saunders
Internet Engineer
jo***********@s urfcontrol.com
Nov 17 '05 #5
John,
I set verb="*". I did some searching, and machine.config
configures only HttpGet, HttpPost and HttpSoap requests
by default. The documentation states that this is not
extensible for now.


You may have misunderstood. "HttpPost" has to do with
Web Services. verb="*" should work. Give it a try. You'll
also have to configure IIS to pass that verb to your
handler. Click "Configurat ion" on the Home Directory tab.


This is perfect. I don't have to write any ISAPI dlls. I have tested
your suggestions, and they work great!

Thanks again.

Cheers,
Chris Hughes

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 17 '05 #6

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

Similar topics

10
7793
by: Richard A. DeVenezia | last post by:
At line this.timerId = setInterval (function(){this.step()}, 100) I get error dialog Error:Object doesn't support this property or method. If I change it to this.timerId = setInterval (function(){this==window}, 100) I see true, the sad fact that 'this' is window and not an anim. What are some proper ways ? I would like to avoid
10
3604
by: tony kulik | last post by:
This code works fine in ie and opera but not at all in Mozilla. Anybody got a clue as to how to get it right? <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <script language="JavaScript" type="text/javascript"> function show(that) { if (box.style.visibility=='hidden') { that.style.visibility = 'visible'}; }
1
3848
by: Nimmi Srivastav | last post by:
There's a rather nondescript book called "Using Borland C++" by Lee and Mark Atkinson (Que Corporation) which presents an excellent discussion of overloaded new and delete operators. In fact there are quite a few things that I learned that I did not know before. For example, while I knew that the new and delete operators can be overloaded for classes, I did not know that that the global new and delete operators can also be overloaded. ...
7
5230
by: Paul Reddin | last post by:
Hi, Having just upgraded one of our servers to V8.2, the CONTINUE HANDLERs in Stored procedures seem to be behaving differently? i.e Instead of continuing at the next statement (as they did before on V8.1) they now exit immmediately ???? e.g from 1 SP
0
1176
by: MechSoft | last post by:
Hi, there, I have an issue about globally access data. My multi-threaded application has some resources that need to be accessed by multiple threads and have the lifetime of the application, such as the logging mechanism, various machine statuses. I encapsulate them in different classes and use global objects right now. As I look more into c++ programming, I realize that I could improve my code quality by ensuring only one object of...
2
2434
by: Norton | last post by:
I understand how to create HTTP modules that can be used to add functionality to a website but there are a few things I don't understand. If I create an HTTP Module and I want it to intercept a call to AuthenticateRequest, I know that in my init function for my HTTP module, I can add a handler to this method name and then use this event handler delegate to call my own function. I saw some sample code though that mentioned (for some...
15
2469
by: randyr | last post by:
I am developing an asp.net app based on a previous asp application. in the asp applications global.asa file I had several <object id="id" runat="server" scope="scope" class="comclass"> tags for objects that the app used to speed up some global level data access and functionality. I have recoded the class libraries in .net and would like to acomplish the same functionality in asp.net.
16
2516
by: Hamed | last post by:
Hello I am developing a utility to be reused in other programs. It I have an object of type Control (a TextBox, ComboBox, etc.) that other programmers use it in applications. they may set some of properties or assign event handlers. I need to be able to clone the manipulated control at runtime. I could use the Clone method of some objects (like Font, Style, String,
30
1957
by: David Mathog | last post by:
Every so often I find a need to move data in or out of functions which are not called directly. For instance, alarm handlers or the compare function used by qsort. In these cases there is no possibility of passing the data as a function parameter, so it needs to be "smuggled" in. Is there a better way of doing this than the three methods described below? 1. use global variables. This is fine for small monolithic programs but isn't...
3
1658
by: eschneider | last post by:
Just some common issues with WS: Using custom objects: When objects change, seems you are always fixing some issue. Update references, which sometimes does not work. Deployment: Weird errors which take a while to fix because the error stink: Forget to set ASP.NET 2.0="Parser Error Message: Could not load type" '*.Global' is ambiguous: it could come from assembly=I deleted the
0
9456
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9275
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
10034
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...
1
9843
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9713
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6534
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
5304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3805
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
3358
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.