Lars Holdgaard
Lars Holdgaard

Reputation: 9996

404 Pages when tampering with the extention of the page

I have a Sitecore solution, where we handle 404 requests.

We do that by setting "ErrorPage" and the "ItemNotFoundUrl" in the web.config:

<setting name="ErrorPage" value="/sitecore/service/error.aspx" />

And

<setting name="ItemNotFoundUrl" value="/Global/ErrorPages/404" />

Now, this works when we edit the name of the page. So if we have www.domain.com/mypage.aspx , and go to www.domain.com/mysdfsa.aspx which doesn't exist, it will show our error-page.

However, if we go to something like:

www.domain.com/mypage.zip / www.domain.com/mypage.gosfgfgs

It gives the IIS error:

Error Summary
HTTP Error 404.0 - Not Found
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

What have I tried?

We need to make it for for ZIP files at least.

Any ideas? :-) Thanks

Upvotes: 2

Views: 582

Answers (1)

Mark Ursino
Mark Ursino

Reputation: 31435

I think in the <preprocessRequest> pipeline there's a processor for extensions that Sitecore handles. You should try to update that:

<processor type="Sitecore.Pipelines.PreprocessRequest.FilterUrlExtensions, Sitecore.Kernel">
  <param desc="Allowed extensions (comma separated)">aspx, ashx, asmx</param>
  <param desc="Blocked extensions (comma separated)">*</param>
  <param desc="Blocked extensions that stream files (comma separated)">*</param>
  <param desc="Blocked extensions that do not stream files (comma separated)"></param>
</processor>

Upvotes: 2

Related Questions