Ted
Ted

Reputation: 7251

Recommended practice for restricting ImagerResizer module to just one specific route/sub-directory?

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)?

Details:

Upvotes: 0

Views: 55

Answers (1)

Lilith River
Lilith River

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

Related Questions