custom errors not behaving as expected

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
 
D

David

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top