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
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
jame...@online.microsoft.com
This post is provided "AS-IS" with no warranties and confers no rights.
--------------------
| From: "Nick Horrocks" <nickho...@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$DI2XxE...@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.net!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
"Jim Cheshire [MSFT]" <jame...@online.microsoft.com> wrote in message
news:RX9pNPd...@cpmsftngxa10.phx.gbl...
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
jame...@online.microsoft.com
This post is provided "AS-IS" with no warranties and confers no rights.
--------------------
| From: "Nick Horrocks" <nickho...@hotmail.com>
| References: <OP$DI2XxE...@TK2MSFTNGP11.phx.gbl>
<RX9pNPd...@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: <efEzOtjx...@TK2MSFTNGP09.phx.gbl>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: 213.52.137.34
| Path:
cpmsftngxa10.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09
phx.gbl
| Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.framework.aspnet:274629
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
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]" <jame...@online.microsoft.com> wrote in message
news:x2vchvpx...@cpmsftngxa10.phx.gbl...
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
jame...@online.microsoft.com
This post is provided "AS-IS" with no warranties and confers no rights.
--------------------
| From: "Nick Horrocks" <nickho...@hotmail.com>
| References: <OP$DI2XxE...@TK2MSFTNGP11.phx.gbl>
<RX9pNPd...@cpmsftngxa10.phx.gbl>
<efEzOtjx...@TK2MSFTNGP09.phx.gbl>
<x2vchvpx...@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: <O6jD4kwx...@TK2MSFTNGP11.phx.gbl>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: 213.52.137.34
| Path:
cpmsftngxa10.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTFEED02.phx.gbl!tornado.fas
twebnet.it!tiscali!newsfeed1.ip.tiscali.net!news.glorb.com!hammer.uoregon.ed
u!enews.sgi.com!msrnewsc1!msrtrans!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP11.phx.gbl
| Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.framework.aspnet:274958
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
Silly idea: How about
Response.StatusCode = 404;
in your error page (assuming it's not a static HTML page)?
Cheers,
--
Joerg Jooss
www.joergjooss.de
ne...@joergjooss.de