473,666 Members | 2,237 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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="RemoteOnl y" 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 3963
"Vlad" <v.*******@gmai l.comwrote ...
<customErrors mode="RemoteOnl y" 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
1558
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 for some hint on how to include my own ressources in IDE-generated satellite-assemblies (because there can only be on assembly per each language) I decided to try to use the XML-editor for the IDE-generated .resx-files again. I noticed that the...
4
1804
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 database instead. I've imported the values, and am retrieving them as FOR XML AUTO in the stored proc to mimic the structure in the web.config. I'm confused now - what data type is being returned by...
3
6244
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 put the above string into the web.config file, it fails due to a double quotes. Is there any way I can do it? <appSettings> <add key="Patient" value="select reg_date "Regiatration" from
13
2694
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, and also from a file conatining the commands 2- does the redirection of the input and output from and to files. 3- retrieve the environment variables like HOME,..
5
5730
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" and value is "monkey". I've tried the following ways to retrieve the value and only one works: //Returns null Configuration config = ConfigurationManager.OpenExeConfiguration(Assembly.GetEntryAssembly().Location); string monkey =...
1
3522
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, @filesize("$userPath/xml/redirect.xml")); @fclose($fileID); // XML PARSE
3
1597
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' information. thank you for reading this
9
2714
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): System.Collections.Specialized.NameValueCollection SectionIndex = (System.Collections.Specialized.NameValueCollection)System.Configuration.ConfigurationSettings.GetConfig("Rewrite.NET/Index"); The value always returns me null, and just to check it was...
6
7293
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 figure out what is going on here. I have taken it all the way back to just selecting the configuration node (top level node), and it fails! How can this line fail (returns null)??
0
8440
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8355
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8866
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8781
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7381
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4193
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2769
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 we have to send another system
2
2006
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1769
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.