Reputation: 7251
What is the recommended practice for restricting ImageResizer to only act on images within a specified sub-directory (in my personal case requiring watermarks only on images within a certain directory via PostRewrite, but apart from a couple sub-directories, I really don't want site-wide images even touching the InterceptModule if I don't have to)?
<location ...>
in Web.config:
<location path="some-path/some-directory" inheritInChildApplications="false">
<system.webServer>
<httpModules>
<add name="ImageResizingModule" type="ImageResizer.InterceptModule"/>
</httpModules>
</system.webServer>
</location>
Application.BeginRequest filter out on path.
Details:
Upvotes: 0
Views: 55
Reputation: 16468
Handle Config.Current.PostRewrite
and set process=no
and cache=no
in the event parameters (querystring). This will disable ImageResizer interaction with the request.
As mentioned in Configuring ImageResizer to only work in certain directories, you cannot make HttpModules location-specific. They are application-wide, always.
By default, ImageResizer doesn't do anything to images unless you specifically request it via the querystring. It does (with authorizeAllImages="true") permit you to control access via AuthorizeImage
, as well as perform URL rewriting via Rewrite
and PostRewrite
events.
If the images are being served from a VirtualPathProvider, it will enable that to work by assigning the request to StaticFileHandler; but if the images are physical files, it does nothing.
If you want true isolation, you can always set up a child app (sub-application) with a separate application pool, mounted in a subdirectory.
Upvotes: 1