473,405 Members | 2,185 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

web.config redirection returns 302 instead of 404

Hello everybody,

I have a problem with custom error page. I' using a redirection in a
web.config file to a custom error page:

<customErrors mode="RemoteOnly" defaultRedirect="/_err/generic.aspx">
<error statusCode="404" redirect="/_err/not-found.aspx" />
</customErrors>

My custom error page "not-found.aspx" returns "HTTP Status Code: 404
Not found" which is OK.
But when I'm trying to check HTTP Status Code of non existing page it
is returns "HTTP Status Code: 302 Found" which means Temporary
Redirection. Any Ideas how to fix this problem? I want non existing
page return "HTTP Status Code: 404 Not found" as well.

Thank you,
Vlad.

Dec 6 '06 #1
1 3952
"Vlad" <v.*******@gmail.comwrote ...
<customErrors mode="RemoteOnly" defaultRedirect="/_err/generic.aspx">
<error statusCode="404" redirect="/_err/not-found.aspx" />
But when I'm trying to check HTTP Status Code of non existing page it
is returns "HTTP Status Code: 302 Found" which means Temporary
Redirection. Any Ideas how to fix this problem? I want non existing
page return "HTTP Status Code: 404 Not found" as well.
I'm not sure I understand your problem but if it's what I think you're
saying, you can't rely on ASP.NET to handle this for you.

I believe what's happening is that ASP.NET is generating a 302 re-direct to
the 404 page. This is a totally backwards way of handling things and reveals
the ASP.NET development team's lack of experience with search engines, which
expect to see the 404 returned immediately.

Perhaps someone else can explain a method of handling this that doesn't
require custom HTTP error handling within each ASP.NET page. Otherwise I'll
be happy to post or send you some sample custom error handlers I use within
ASP.NET pages to generate custom errors directly.

Here's an example of direct custom error handling within an ASP.NET page:
http://hotelmotelnow.com/hotels.aspx/11292520/

Notice this page returns a "410 - Gone" in the header in response to bad
data. That is for the search engines. There is also text on the page for the
user, and diagnostics for me. Since there is no default custom redirect
defined in web.config, a non-existing page also returns a "404 - Not Found"
directly using ASP.NET's default error handler.

Here are two relevant examples of direct 404 error handling:
The first utilizes the same custom error handler as above.
http://hotelmotelnow.com/hotels.aspx/missing.htm
The second uses the ASP.NET default error handler, which works because
there are no custom error handlers defined in web.config.
http://hotelmotelnow.com/missing.aspx

Regards,

Fred Chateau

Dec 7 '06 #2

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

Similar topics

1
by: Rolf Molini | last post by:
Hello everybody, I put this in a separate thread because altough it is connected to the localization-problem in my former thread this is a completely different "joke" of the IDE. While waiting...
4
by: brent | last post by:
Currently our application is reading from the web.config, and retrieves a section, "softwareRequirements". Because the section will begin to grow dramatically, I'd like to place it in the SQL...
3
by: Assembly file locked | last post by:
I'm trying to put a SQL statement in a web.config file. But I'd like to have a customized column name as I normally do in ORACLE: e.g. select reg_date "Registration" from patient But when I...
13
by: souissipro | last post by:
Hi, I have written a C program that does some of the functionalities mentionned in my previous topic posted some days ago. This shell should: 1- execute input commands from standard input,...
5
by: Keith | last post by:
Hello all, I have a C# Windows Forms app. It is in namespace App.GUI. It builds to Nav.exe. I have entered an application level setting using the designer. Its type is string, name is "FOO"...
1
by: comp.lang.php | last post by:
require_once("/users/ppowell/web/php_global_vars.php"); if ($_GET) { // INITIALIZE VARS $fileID = @fopen("$userPath/xml/redirect.xml", 'r'); $stuff = @fread($fileID,...
3
by: postindex | last post by:
Can I get whole commandline not only argument list. 1. When I command like this $ a.py filename 2. sys.argv is returns only argument list Is there a way to find out 'redirection'...
9
by: Milsnips | last post by:
Hi all. i'm tryng to implement the Rewrite.NET url rewritining functionality into a test project i've created, however i am hitting a problem at this line (direct from the web example): ...
6
by: J.Marsch | last post by:
I must be completely losing my mind. I have some code that writes to config files. It works great with app.config files, but fails miserably with web.config files. For the life of me, I cannot...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.