471,056 Members | 1,497 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,056 software developers and data experts.

Custom Errors

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
Nov 18 '05 #1
4 1801
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.
"Jon Spivey" <jo*******@NOCRAPTHANKStiscali.co.uk> wrote in message
news:Om**************@TK2MSFTNGP09.phx.gbl...
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

Nov 18 '05 #2
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

"George Ter-Saakov" <no****@hotmail.com> wrote in message
news:eT**************@TK2MSFTNGP09.phx.gbl...
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.
"Jon Spivey" <jo*******@NOCRAPTHANKStiscali.co.uk> wrote in message
news:Om**************@TK2MSFTNGP09.phx.gbl...
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


Nov 18 '05 #3
Yes.
But you will need to test it with Win2003 before moving to production.
George.

"Jon Spivey" <jo*******@NOCRAPTHANKStiscali.co.uk> wrote in message
news:um**************@TK2MSFTNGP10.phx.gbl...
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

"George Ter-Saakov" <no****@hotmail.com> wrote in message
news:eT**************@TK2MSFTNGP09.phx.gbl...
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.
"Jon Spivey" <jo*******@NOCRAPTHANKStiscali.co.uk> wrote in message
news:Om**************@TK2MSFTNGP09.phx.gbl...
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



Nov 18 '05 #4
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

"George Ter-Saakov" <no****@hotmail.com> wrote in message
news:OG**************@TK2MSFTNGP11.phx.gbl...
Yes.
But you will need to test it with Win2003 before moving to production.
George.

"Jon Spivey" <jo*******@NOCRAPTHANKStiscali.co.uk> wrote in message
news:um**************@TK2MSFTNGP10.phx.gbl...
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

"George Ter-Saakov" <no****@hotmail.com> wrote in message
news:eT**************@TK2MSFTNGP09.phx.gbl...
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.
"Jon Spivey" <jo*******@NOCRAPTHANKStiscali.co.uk> wrote in message
news:Om**************@TK2MSFTNGP09.phx.gbl...
> 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
>
>



Nov 18 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Tamas Demjen | last post: by
6 posts views Thread by Nick Horrocks | last post: by
5 posts views Thread by Richard | last post: by
reply views Thread by gilly3 | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.