Solved

Custom Error settings only picking up 404 on ASPX

Posted on 2004-08-27
4
222 Views
Last Modified: 2012-06-27
Custom Error settings only picking up 404 on ASPX pages and not directories addresses or other file types such as .html

This is what I have in my web.config.  I'm using a remote host and only have FTP abilities.

     <customErrors mode="RemoteOnly">
       <error statusCode="404" redirect="/error_docs/Oops.aspx" />
     </customErrors>
0
Comment
Question by:dgelinas
4 Comments
 
LVL 17

Accepted Solution

by:
AerosSaga earned 150 total points
ID: 11914404
Since .html files are not being interepreted by the .NET Compiler they would not be redirected on error.  If this is what you want then you would need to put the html pages in a .aspx or .ascx wrapper so that IIS will handle correctly.

Regards,

Aeros
0
 
LVL 15

Assisted Solution

by:Thogek
Thogek earned 150 total points
ID: 11914931
Actually, given that dgelinas is looking for 404 error handling (which occurs when no file exists at the requested URL), there's nothing to wrap in ASPXs....

But Aeros is right: those customErrors settings will only affect errors that arise during (or during an attempt to call) a page/file that is part of the ASP.NET application, which includes any ASPX, ASCX, or related code (C# or VB) files, but does not include HTML files, non-.NET ASP files, etc.

So, if a user attempts to request a URL with a *.aspx extension, the handling of this request would be handed to ASP.NET, and ASP.NET could serve its custom errors.  But if a user attempts to request a URL with a *.html extension, this is not processed by the ASP.NET application, so no customErrors setting in the ASP.NET application would have the chance to come into play.

If you need to specifiy custom 404 error pages for your Web site or application, regardless of whether or not the requested URL is an ASP.NET application file, you'll likely need to do so within IIS itself.  In this case, go into your Internet Information Services Manager, find your Web site or Web application virtual directory, right-click and select "Properties".  Select the "Custom Error" tab, select the line for the HTTP error you wish to intercept (such as 404), then click "Edit Properties".  You can then set the Message Type to File and enter your own local static file to be used, or set the Message Type to URL and specify the URL to which all 404 errors should be redirected.  This will then take effect for all such errors that occur within that Web site or directory, regardless of the type of file being requested.
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question