IHttpHandler vs IHttpModule

后端 未结 5 1343
一整个雨季
一整个雨季 2020-12-07 09:52

My question is simple (although the answer will most likely not be): I\'m trying to decide how to implement a server side upload handler in C# / ASP.NET.

I\'ve us

5条回答
  •  [愿得一人]
    2020-12-07 10:09

    Modules are intended to handle events raised by the application before and after the request is actually processed by the handler. Handlers, on the other hand, aren't given the opportunity to subscribe to any application events and, instead, simply get their ProcessRequest method invoked in order to the "main" work of processing a specific request.

    Take a look at this documentation from Microsoft (about half way down the page in the "The request is processed by the HttpApplication pipeline" section):

    http://msdn.microsoft.com/en-us/library/bb470252.aspx

    You can see in step 15 where the handler gets its chance to execute. All of the events before and after that step are available for interception by modules, but not handlers.

    Depending on what specific features you're trying to achieve, you could use either a handler or a module to implement an upload handler. You might even end up using both.

    Something to consider might to use an upload handler that's already written.

    Here's a free and open source one:

    http://www.brettle.com/neatupload

    Here's a commercial one:

    http://krystalware.com/Products/SlickUpload/

    If you look at the documentation for NeatUpload, you'll see that it requires you to configure a module.

提交回复
热议问题