Custom Errors

  • Thread starter Thread starter Jon Spivey
  • Start date Start date
J

Jon Spivey

Hi,
I've set up a custom error like this

<customErrors mode="On" defaultRedirect="ErrorPage.aspx">
<error statusCode="404" redirect="error404.aspx" />
</customErrors>

So requests for NoSuchPage.aspx are routed to error404.aspx. Good. But it
seems that requests for any other file extension (*.htm) or requests without
a filename (eg www.site.com/nosuchfolder) are routed to the default 404
page. Is this by design or is there something I need to modify to send all
bad requests to the custom error page?
Ideally i want users to be able to type www.site.com/productid (where
productid will always be a 10 digit number) send the request to
error404.aspx strip out the product id and redirect to
showproduct.aspx?id=productid but as it stands a request like that will go
to the default 404 page

Cheers,
Jon
 
The problem is that on Win2000/XP ASP.NET is not tightly integrated with
IIS. It's just hooked up to certain extensions as an ISAPI DLL

So request for any extension like htm, gif,... (which is not hooked up to
ASP.NET ) does not go through ASP.NET and your webconfig is ignored.

The solution is to upgrade to Win2003.

George.
 
This sounds good, I'm developing on XP Pro IIS5.1 but will host on Win2003
IIS6. Are you saying the custom errors will work as I want when I go into
production?

Jon
 
Yes.
But you will need to test it with Win2003 before moving to production.


George.
 
Done some testing on Win2003/iis6 and custom errors are still behaving the
same way ie only working for .aspx pages. So I went into IIS and set the 404
to 404.aspx - requests for anything other than .aspx are routed to this page
..aspx requests go to the error page defined in web.config. This isn't ideal
but it does work.

Thanks for your help,
Jon
 
Back
Top