2

I have an Orchard project and am trying to implement a not found page. I have used the following implementation to allow a static page

http://orchard.codeplex.com/discussions/264312

although I am running IIS6 so used the following to actually direct the user to the page.

<customErrors mode="On">
      <error statusCode="404" redirect="Errors/404.htm"/>
</customErrors>

The problem I have is that I checked in fiddler and the page is not being returned with a 404 status code.

I have being trying to work out how I would set this status code since the page is a standard html page, I was looking at adding a custom header is IIS

enter image description here

But couldn't find anything detailing what to put here

I also tried setting the 404 page in the error pages section

enter image description here

But this didn't seem to work

Can anyone tell me how I get the server to return the html page with a 404 status code?

Tom
  • 12,591
  • 13
  • 72
  • 112

3 Answers3

1

Try rewriting the response instead of redirecting:

<customErrors mode="On" redirectMode="ResponseRewrite">
  <error statusCode="404" redirect="Errors/404.htm"/>
</customErrors>

or handle errors as shown here.

Community
  • 1
  • 1
Darin Dimitrov
  • 1,023,142
  • 271
  • 3,287
  • 2,928
  • Have tried the above and I seem to just get the standard 404 screen when ResponseRewrite is in there and get my error page with status 200 when the redirect mode is set to ResponseRedirect. I don't know how easy it will be to do your other solution from within orchard, – Tom Sep 20 '11 at 13:38
  • is it possible to force that file to always be served with a 404 status code? – Tom Sep 20 '11 at 13:45
0

I would "back out" your direct IIS changes in the "headers" and "custom errors" tabs and try -

<error statusCode="404" redirect="~/Errors/404.htm"/>
Kris Krause
  • 7,304
  • 2
  • 23
  • 26
0

This looks like this bug: http://orchard.codeplex.com/workitem/16244

Bertrand Le Roy
  • 17,731
  • 2
  • 27
  • 33