Nick,
It's not an oversight. It's because of the way that ISAPI works with IIS.
In order for an IIS status code to be redirected to a custom page without a
302, it has to be handled by IIS itself. Once you pass that layer and get
into the ASP.NET ISAPI dll, you can no longer redirect without a 302.
There is no way around that.
In the case of a 404, you are only returning that if a page that is
requested does not exist. Therefore, I fail to see why you cannot simply
handle this with IIS.
Jim Cheshire [MSFT]
MCP+I, MCSE, MCSD, MCDBA
ASP.NET Developer Support
ja******@online.microsoft.com
This post is provided "AS-IS" with no warranties and confers no rights.
--------------------
| From: "Nick Horrocks" <ni**********@hotmail.com>
| References: <OP*************@TK2MSFTNGP11.phx.gbl>
<RX*************@cpmsftngxa10.phx.gbl>
<ef**************@TK2MSFTNGP09.phx.gbl>
<x2**************@cpmsftngxa10.phx.gbl>
| Subject: Re: Custom not found and HTTP status code
| Date: Wed, 10 Nov 2004 09:39:44 -0000
| Lines: 118
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
| Message-ID: <O6**************@TK2MSFTNGP11.phx.gbl>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: 213.52.137.34
| Path:
cpmsftngxa10.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFT FEED02.phx.gbl!tornado.fas
twebnet.it!tiscali!newsfeed1.ip.tiscali.net!news.g lorb.com!hammer.uoregon.ed
u!enews.sgi.com!msrnewsc1!msrtrans!TK2MSFTNGP08.ph x.gbl!TK2MSFTNGP11.phx.gbl
| Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.framework.aspnet:274958
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Well that seems a really appauling oversight.
|
| I would be very happy for IIS to handle ALL 404 errors. However, if I want
| to trap errors and display a nice message to the user I have to abandon
| normal HTTP standards for 404 errors on any page with a .ASPX extension.
|
|
|
|
| "Jim Cheshire [MSFT]" <ja******@online.microsoft.com> wrote in message
| news:x2**************@cpmsftngxa10.phx.gbl...
| > Nick,
| >
| > You can't if you are going to use a customErrors page. If you rely on
| > ASP.NET to do the redirect to the custom error page, you are going see a
| > 302 for the redirect. If you don't want that, you have to control this
at
| > the IIS level.
| >
| > Jim Cheshire [MSFT]
| > MCP+I, MCSE, MCSD, MCDBA
| > ASP.NET Developer Support
| >
ja******@online.microsoft.com
| >
| > This post is provided "AS-IS" with no warranties and confers no rights.
| >
| > --------------------
| > | From: "Nick Horrocks" <ni**********@hotmail.com>
| > | References: <OP*************@TK2MSFTNGP11.phx.gbl>
| > <RX*************@cpmsftngxa10.phx.gbl>
| > | Subject: Re: Custom not found and HTTP status code
| > | Date: Tue, 9 Nov 2004 09:05:46 -0000
| > | Lines: 58
| > | X-Priority: 3
| > | X-MSMail-Priority: Normal
| > | X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
| > | Message-ID: <ef**************@TK2MSFTNGP09.phx.gbl>
| > | Newsgroups: microsoft.public.dotnet.framework.aspnet
| > | NNTP-Posting-Host: 213.52.137.34
| > | Path:
| >
|
cpmsftngxa10.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFT NGP08.phx.gbl!TK2MSFTNGP09
| > phx.gbl
| > | Xref: cpmsftngxa10.phx.gbl
| microsoft.public.dotnet.framework.aspnet:274629
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| > |
| > |
| > | In that case how can I display a message to users telling tham that
the
| > page
| > | has moved while at the same time responding with a 404 HTTP status.
Just
| > as
| > | I can with IIS.
| > |
| > |
| > | "Jim Cheshire [MSFT]" <ja******@online.microsoft.com> wrote in message
| > | news:RX*************@cpmsftngxa10.phx.gbl...
| > | > Hi Nick,
| > | >
| > | > Don't use a custom error page. A custom error page will always
cause
| > the
| > | > Web server to redirect the user to the custom error page. That is
| done
| > | > using a Response status of 302 with a Location header.
| > | >
| > | > Jim Cheshire [MSFT]
| > | > MCP+I, MCSE, MCSD, MCDBA
| > | > ASP.NET Developer Support
| > | >
ja******@online.microsoft.com
| > | >
| > | > This post is provided "AS-IS" with no warranties and confers no
| rights.
| > | >
| > | > --------------------
| > | > | From: "Nick Horrocks" <ni**********@hotmail.com>
| > | > | Subject: Custom not found and HTTP status code
| > | > | Date: Mon, 8 Nov 2004 10:27:41 -0000
| > | > | Lines: 10
| > | > | X-Priority: 3
| > | > | X-MSMail-Priority: Normal
| > | > | X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
| > | > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
| > | > | Message-ID: <OP*************@TK2MSFTNGP11.phx.gbl>
| > | > | Newsgroups: microsoft.public.dotnet.framework.aspnet
| > | > | NNTP-Posting-Host: 213.52.137.34
| > | > | Path:
| > | >
| > |
| >
|
cpmsftngxa10.phx.gbl!TK2MSFTFEED02.phx.gbl!tornado .fastwebnet.it!tiscali!new
| > | >
| > |
| >
|
sfeed1.ip.tiscali.net!news.glorb.com!cyclone.bc.ne t!msrtrans!TK2MSFTNGP08.ph
| > | > x.gbl!TK2MSFTNGP11.phx.gbl
| > | > | Xref: cpmsftngxa10.phx.gbl
| > | microsoft.public.dotnet.framework.aspnet:274313
| > | > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| > | > |
| > | > | I have set up a custom error page for 404 errors.
| > | > |
| > | > | However the HTTP status code returned is 302 followed by 200, this
| > | causes
| > | > | search engines not to remove old pages from their index.
| > | > |
| > | > | How can I get the correct status code to be returned?
| > | > |
| > | > | Thanks
| > | > |
| > | > |
| > | > |
| > | >
| > |
| > |
| > |
| >
|
|
|