Custom Http Error

Topics: Customizing Orchard
Oct 26, 2011 at 3:44 PM
Hi.

I want to customize error pages.

I tried this method:
<customErrors mode="RemoteOnly">
      <error redirect="404.html" statusCode="404"/>
</customErrors>

[...]

<system.webServer>
    <handlers accessPolicy="Script,Read">
       [...]
      <add name="Http404" path="404.html" verb="*" modules="StaticFileModule" preCondition="integratedMode" resourceType="File" requireAccess="Read" />
    </handlers>
  </system.webServer>
The problem with this method is that it needs a static file.

But I want error pages contain dynamic widgets such as list of recent post of a blog.
So I tried this method:
<httpErrors errorMode="Custom">
	<remove  statusCode="404" subStatusCode="-1" />
	<error statusCode="404"path="/404.html" responseMode="ExecuteURL" />
</httpErrors>


Here, I have a dynamic error page but the problem that the HTTP header is not good.
It should have a
404 return code but returns a 200 code instead.

The fact that the return code is not good potential problem when using analysis tools site as "Xenu's Link".
The detection of links will not be good for detecting broken links and sitemap generation for example.

 Are there an easy way for error pages with dynamic content and with the correct code http?
Excuse me for my english.