Hi,
Try with mode="On"
<customErrors mode="On" defaultRedirect="/misc/pagenotfound.aspx">
</customErrors>
Why that ugly page is displaying is that you are viewing page on your local
host and mode is set to "RemoteOnly".You need to set mode to "On".
Description of different modes are:
On
Specifies that custom errors are enabled. If no defaultRedirect attribute
is specified, users see a generic error. The custom errors are shown to the
remote clients and to the local host.
Off
Specifies that custom errors are disabled. The detailed ASP.NET errors are
shown to the remote clients and to the local host.
RemoteOnly
Specifies that custom errors are shown only to the remote clients, and that
ASP.NET errors are shown to the local host. This is the default value.
Hope this helps.
--
Thanks and Regards.
Manish Bafna.
MCP and MCTS.
"Mark" wrote:
I think I am missing something about how to redirect to a certain page when
404 errors occur. I want to redirect to a generic pagenotfound.aspx page. I
have the following in web.config:
<customErrors mode="RemoteOnly" defaultRedirect="/misc/pagenotfound.aspx">
</customErrors>
However, when I enter a non-existent URL I just get the default Page Not
Found error page - my pagenotfound.aspx file is not invoked (it works fine if
I enter the full URL of the http://www.mysite.com/misc/pagenotfound.aspx page
directly, so there is no issue with the page itself).
I have this working fine on an ASP.Net 1.1 site.
Any ideas on what I am doing wrong?
Thanks.