CustomErrors only catches explicit page links
-
20-09-2019 - |
Question
I have custom errors turned on and when I go to
www.mywebsite.com/video/default.aspx
it shows error which corresponds to 404 and this is fine
but when I go to www.mywebsite.com/video/
it shows a generic iis 404 error.
My other pages that have files work fine like
www.mywebsite.com/photo/
would redirect to www.mywebsite.com/photo/default.aspx
because files exists and default is setup in IIS.
Please help. Thanks!
Solution
The 404 handler specified in the web.config only works for files handled by the ASP.NET runtime. This is why it is working for www.mywebsite.com/video/default.aspx
and not www.mywebsite.com/video/
, the generic error your observing is the one configured by default in IIS. You will need to go into IIS Manager and set 404's to be redirected to your PageNotFound.aspx
.
Here's some more infomtion on configuring custom error messages in IIS 6.0.