custom errors not behaving as expected

  • Thread starter Thread starter ilyasdhin
  • Start date Start date
I

ilyasdhin

Hi all

In my web application I have the following present for customErrors

<customErrors mode="On">
<error statusCode="404" redirect="PageNotFound.aspx" />
</customErrors>

My application has 2 pages, Page1.aspx and PageNotFound.aspx

I have published this application so that its now under IIS and if I
attempt to browse to Page2 (which doesnt exists) the PageNotFound is
correctly displayed. However if I attempty to browse to say File1.doc,
then the PageNotFound.doc doesnt get displayed, in fact if I browse to
File1.txt or File.ppt, the same thing happens

It appears as though the PageNotFound.aspx is only displayed if the
request was for a .aspx page. This is not what I want, because my
applications creates and deletes documents, and I want a nice page to
be displayed when a document that doesnt exist is requested

Any ideas why this is happening? Is it by design?

Many thanks
 
It is because your non-aspx pages are not going through the .NET process, in
which case, the non-aspx pages will not cause the 404 aspx page.

How do you get around it?
Go into IIS and tell it to call your pagenotfound page when IIS reports a
404. You can't really handle the situation fully from within .NET alone.

--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available
 
Back
Top