Home > 404 error > 404 error in asp page

404 Error In Asp Page

Contents

here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business 404 error page template Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation google 404 error page Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like

404 Error Page Not Found

you, helping each other. Join them; it only takes a minute: Sign up How to return 'own' 404 custom page? up vote 9 down vote favorite 2 In case if error occurred on my web site I

Funny 404 Error Page

do the following: Server.Transfer("/error.aspx"); and that page has code: protected void Page_Load(object sender, EventArgs e) { ... Response.StatusCode = 404; } If I work on the localhost then together with 404 status returned for the page, page displays 'proper error description'. Once I published the same code to the internet all pages with errors are still displayed with 404 status code, but the don't have the content. Instead, they have the standard 404 error message: 404 error page design 404 - File or directory not found. if the line "Response.StatusCode = 404" commented out then the proper page is provided, but it has 200 status code. Question: how to return user-friendly error page that in the same time has 404 error status code? Any thoughts are welcome! Thanks a lot in advance! P.S. ASP.NET 4.0 asp.net http-status-code-404 share|improve this question asked Apr 12 '12 at 2:57 Budda 7,5112087156 I've always done custom 404 pages in the same way. 1) Transfer to error page 2) user friendly page copy and a 404 under the bonnet for robots. One site I'm trying to do this on now I'm having exactly the same problem - if I add "Response.Status" then a standard 404 is displayed - remove the response.status and the page copy appears but returns a 200. My uneducated guess is something changed in .NET4 framework... –Jag Apr 29 '13 at 10:50 add a comment| 5 Answers 5 active oldest votes up vote 8 down vote http://msdn.microsoft.com/en-us/library/h0hfz6fc(v=vs.71).aspx http://msdn.microsoft.com/en-us/library/aa479319.aspx share|improve this answer answered Apr 12 '12 at 6:44 adt 3,33631939 4 While it's totally correct, I'd recommend, if possible, not to use an ASPX for error pages. If the error is related to something in the ASP engine then the error page may not lo

your web site. The custom errors can be set or overridden on a site wide or directory-by-directory basis. While some web.config sections require that the directory is set as an application, this isn't one of

404 Error Page Examples

them. A simple web.config with a httpErrors section may be placed in any 404 error page html directory, and the directory does NOT need to be set as an application. What are http errors? HTTP errors are returned 404 error page game to the client when something goes wrong on the server. Error status codes are returned if the requested file isn't found (404), or due to coding errors in the web page (500), and due http://stackoverflow.com/questions/10116804/how-to-return-own-404-custom-page to temporary issues such as failed database connections (500). The most common errors are 404 (file not found) and 500 (application) errors. Custom 404 and 500 errors are typically used to provide a friendlier error message to your users. Custom 404 and 500 errors could also redirect the user to the default (or any) page, and are sometimes used to notify the web site administrator of problems on the https://www.stokia.com/support/misc/web-config-custom-httperrors.aspx web site. If you wish to configure custom errors for your site, or even just for a single directory in your site, please follow the directions on this page. 400 Error (bad request) 401 Error (unauthorized) 403 Error (forbidden) 404 Error (not found) 500 Error (internal server error) How it's done Example custom HTTP errors. Comments are enclosed in and are not required. Capture and return specific error types Using Custom Errors Use a text editor to create a file named web.config Save the web.config file with the appropriate content Place the web.config file in the directory that you wish to modify Detailed web.config content If there isn't an existing web.config in the directory, your new web.config should look something like this