Do I have to modify the root web.config file under Orchard.Web in order to support custom library that need to register httpmodules

Topics: Core, Customizing Orchard, Writing modules
Jun 9, 2013 at 9:05 AM
Edited Jun 9, 2013 at 9:05 AM
I'm recently developing a orchard module which add Image re-sizing functions by using library from:

http://imageresizing.net/

the problem is that for this imageresizer library to work, it needs to register a httpmodule in the website's web.config file.
<httpModules>
  <add name="ImageResizingModule" type="ImageResizer.InterceptModule" />
</httpModules>
If i only register it under the module's web.config file, request sending to other modules or the Media folder won't be handled by this httpmodule. But I really don't want to modify the root web.config file from Orchard.Web as it relies on additional modification for an Orchard module to work.

Any work around so that we can sort this out?
Developer
Jun 9, 2013 at 11:04 AM
Have a look at the latest source from the 1.x branch, specifically the MediaProcessing module. It's using ImageResizing, but I don't see any reference to it from web.config.
Jun 9, 2013 at 12:00 PM
I did checked MediaProcessing module but it seems like there is no URL API functionality been used there.

What I mean is ImageResizing has got an URL API which can let me resize the image by simply provide query string in the URL:

For example: http://domain.com/example.jpg?height=100&width=100

http://imageresizing.net/docs/basics

And in order to do that, a httpmodule need to be registered in web.config file.
Developer
Jun 9, 2013 at 7:09 PM
Yes, you can't use a http module without modifying the Web.config.
Coordinator
Jun 26, 2013 at 8:22 AM
Also, you do not want to expose such hackable urls for resized images and ImageResizer is wrong to provide those: it's a vector for DOS attacks. What sizes of images are available should be determined by the site author, not by end users.
Apr 10, 2014 at 5:19 AM
@Bertrand what you say is true in theory. However. I have been running ImageResizer (on Orchard) for several years and have never experienced a problem. Maybe I have been lucky enough not to experience any DOS attacks, but I think ImageResizer deserves some credit for it's design in this respect. Please see: http://imageresizing.net/docs/benefits/stable.