Solved

Custom Error settings only picking up 404 on ASPX

Posted on 2004-08-27
4
226 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

636 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