Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Custom Error settings only picking up 404 on ASPX

Posted on 2004-08-27
4
Medium Priority
?
228 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 600 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 600 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…

927 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