473,465 Members | 1,976 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

custom errors not behaving as expected

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

Apr 16 '07 #1
1 989
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
<il*******@googlemail.comwrote in message
news:11**********************@o5g2000hsb.googlegro ups.com...
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

Apr 16 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: DamonChong | last post by:
Hi, I am new and had this piece of code which I created but it is not behaving as expected. I'm using g++, can someone help me out? Thank you. //--------file (Object.cc)----------- class Object...
1
by: Ollie Riches | last post by:
I have written a custom logging sink for the enterprise library logging application block (June 2005). I have been able to configure it as expected from the UI config tool (EntLibConfig.exe). I...
4
by: Jon Spivey | last post by:
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...
2
by: Matt | last post by:
Hello all, The app we are working on uses custom errors extensively to provide friendly error pages to users whilst logging the actual exceptions behind the scenes. However.... We are now...
6
by: ryan.d.rembaum | last post by:
Hello, I have code that I wish to use in many web applications. Basically sort of stand utility stuff. So from Visual Studio Project I select add a component and chose Component Class. Lets...
3
by: =?Utf-8?B?R3JhaGFt?= | last post by:
I've added 2 tracking services to the wf runtime; one is the standard SqlTrackingService: trackingService = new SqlTrackingService(<trackingConnectionString>); <workflow...
2
by: User | last post by:
Hi, I have a custom user control. How do I write the script in a way which i can import custom namespace within the custom control? Please advise.. Thanks! mycontrl.ascx <script...
2
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
0
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.