Sorry, thought I'd mentioned that I'd like to avoid redirect which involves a
round trip. Without further reading maybe the title is misleading (my bad) as
I am using redirect in the loosest sense rather than the formal one.
I have had solutions involving tweaks to handlers section that gave the
correct behavior but the site would sometimes hang. That was rolled back with
nothing conclusive determined. I made changes shown in original post which
also give desired behavior and will try them but it is black magic and
nothing in doc suggests why it should work. I don't want a klooj not based on
firm understanding of supported function...thus my questions that were posed.
Do you understand function of modules= parameter? I've posed several
questions. I am trying to find out whether anyone understands how the
parameters work. Does a httpmodule specified using modules= apply to all
requests etc. etc.
Maybe someone actually knows.
Therefore I have posed some questions about how certain <handlers><add>
element parameters do work, hoping someone has familiarity.
--
Pat Pattillo
"Cowboy (Gregory A. Beamer)" wrote:
> Create an HttpHandler and handle the redirect through code. It will allow
> you to discriminate between pages and static files.
>
> --
> Gregory A. Beamer
> MVP, MCP: +I, SE, SD, DBA
>
> Subscribe to my blog
> http://feeds.feedburner.com/GregoryBeamer#
>
> or just read it:
> http://feeds.feedburner.com/GregoryBeamer
>
> ********************************************
> | Think outside the box! |
> ********************************************
> "PatP" <(E-Mail Removed)> wrote in message
> news:182FC482-F93D-4838-91B6-(E-Mail Removed)...
> > We have a site that gets many requests for nonexistent pages, files and
> > folders. We want those requests redirected to the index page. However, for
> > static files (i.e. images and some other extensions) we do not want to
> > redirect and in that case want to return nothing.
> >
> > We had been using the 404 error page to redirect but need to discriminate
> > the type of file being requested so that we do not return a page when an
> > image is required.
> >
> > We'd also like to avoid the round trip of the redirect as performance is
> > an
> > issue.
> >
> > We are using Windows Server Web 64 bit and IIS7.
> >
> > We tested some changes to the <handlers> section in web.config that is
> > used
> > with IIS7 and were actually able to cause the desired behavior. However
> > documentation on the <handlers> element's <add> sub-element is sketchy at
> > best. So is documentation for existing httpmodules that can be specified
> > in
> > <add> sub-element modules= parameter.
> >
> > I am familiar with the default configuration. We made a few changes and
> > here
> > is what seemed to work:
> >
> >
> > <!-- 082108 Handle known firstlook static files (1 - 9) as they had
> > been under StaticFile mapping with path="*" -->
> > <add name="StaticFile1" path="*.jpg" verb="*" type=""
> > modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule"
> > scriptProcessor="" resourceType="Either" requireAccess="Read"
> > allowPathInfo="false" preCondition="" responseBufferLimit="4194304" />
> > <add name="StaticFile2" path="*.jpeg" verb="*" type=""
> > modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule"
> > scriptProcessor="" resourceType="Either" requireAccess="Read"
> > allowPathInfo="false" preCondition="" responseBufferLimit="4194304" />
> > <add name="StaticFile3" path="*.gif" verb="*" type=""
> > modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule"
> > scriptProcessor="" resourceType="Either" requireAccess="Read"
> > allowPathInfo="false" preCondition="" responseBufferLimit="4194304" />
> > <add name="StaticFile4" path="*.css" verb="*" type=""
> > modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule"
> > scriptProcessor="" resourceType="Either" requireAccess="Read"
> > allowPathInfo="false" preCondition="" responseBufferLimit="4194304" />
> > <add name="StaticFile5" path="*.png" verb="*" type=""
> > modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule"
> > scriptProcessor="" resourceType="Either" requireAccess="Read"
> > allowPathInfo="false" preCondition="" responseBufferLimit="4194304" />
> > <add name="StaticFile6" path="*.js" verb="*" type=""
> > modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule"
> > scriptProcessor="" resourceType="Either" requireAccess="Read"
> > allowPathInfo="false" preCondition="" responseBufferLimit="4194304" />
> > <add name="StaticFile7" path="*.swf" verb="*" type=""
> > modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule"
> > scriptProcessor="" resourceType="Either" requireAccess="Read"
> > allowPathInfo="false" preCondition="" responseBufferLimit="4194304" />
> > <add name="StaticFile8" path="*.vbs" verb="*" type=""
> > modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule"
> > scriptProcessor="" resourceType="Either" requireAccess="Read"
> > allowPathInfo="false" preCondition="" responseBufferLimit="4194304" />
> > <add name="StaticFile9" path="*.ocx" verb="*" type=""
> > modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule"
> > scriptProcessor="" resourceType="Either" requireAccess="Read"
> > allowPathInfo="false" preCondition="" responseBufferLimit="4194304" />
> > <add name="StaticFile" path="*" verb="*"
> > type="content.DefaultHttpHandler, content" modules="" scriptProcessor=""
> > resourceType="Either" requireAccess="Read" allowPathInfo="false"
> > preCondition="" responseBufferLimit="4194304" />
> >
> > We took a survey of static files that our site used and elevated them
> > above
> > the final add (path="*" verb="*") so that their handling was unchanged.
> > Then
> > we changed the final (i.e. default or catch-all) add so that it used what
> > is
> > a do-nothing httphandler (empty ProcessRequest method body).
> >
> > We've tried some things that did not work and even experienced some site
> > hangs after deployment so we rolled back. This latest attempt will be
> > tested
> > more thoroughly but it would be nice to understand more about this area.
> >
> > Specifically, how does modules= parameter of the add sub-element work in
> > the
> > context of the handler mappings?
> > Should only HttpModules be specified there?
> > Do any custom modules need to be registered?
> > What does it even mean to specify an HttpModule for a given handler
> > mapping?
> > Would an HttpModule specified there be a replacement? Would the only
> > HttpModules in use be the ones specified without any others being implied?
> >
> > This seems to be an entirely new context for HttpModules with very little
> > if
> > any explanation as to how it works.
> >
> > Also, why do some of the default add elements not specify any type=
> > parameter. In that case which HttpHandler is used?
> >
> > If there is anyone out there with a firm understanding of this area then
> > whatever illuminationcan be provided would be most appreciated. I've
> > Googled
> > til my fingers bled and there's not much there. Microsoft must know
> > because
> > they have the source.
> >
> > We just hope they are in a sharing mood....
> >
> > Thanks!
> > --
> > Pat Pattillo
>
>