Custom Error Page In Web.config
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 Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Implementing a Custom Error page on an ASP.Net website up vote 8 down vote favorite 2 I have an ASP.Net website and I want to use a custom error page. I put the following code in my web.config The problem is when i go to a URL that does not exist is still uses the 404 error page specified in IIS Manager. Question: How can I make it use the error.aspx page I have created? Why do the settings in IIS Manager override the web.config? asp.net web-config custom-error-pages custom-errors share|improve this question edited Mar 1 '10 at 2:37 Çağdaş Tekin 13.3k23654 asked Jan 29 '10 at 10:58 Yeodave 6631614 I am using IIS 6 on Server 2003. –Yeodave Jan 29 '10 at 11:13 add a comment| 3 Answers 3 active oldest votes up vote 18 down vote Try this way, almost same.. but that's what I did, and working. or try to change the 404 error page from IIS settings, if required urgently. share|improve this answer edited Feb 12 '12 at 11:17 Alex Peta 1,1491124 answered Jan 29 '10 at 11:18 Hrushikesh 378111 If I have the tag outside of the tags I get an error. I have to put a closing tag after the error tags but it still does not work. –Yeodave Jan 29 '10 at 12:15 add a comment| up vote 0 down vote resources Windows Server 2012 resources Programs MSDN subscriptions Overview Benefits Administrators Students Microsoft Imagine Microsoft Student Partners ISV Startups TechRewards Events Community Magazine Forums Blogs Channel 9 Documentation APIs and reference Dev centers Retired content Samples We’re sorry. The content you requested has been removed. You’ll be auto redirected in 1 second. Configuration File Syntax ASP.NET Configuration Settings http://stackoverflow.com/questions/2161413/implementing-a-custom-error-page-on-an-asp-net-website TOC Collapse the table of content Expand the table of content This documentation is archived and is not being maintained. This documentation is archived and is not being maintained. Recommended Version This documentation is archived and is not being maintained. customErrors Element (ASP.NET Settings Schema) .NET Framework 3.0 Other Versions Visual Studio https://msdn.microsoft.com/en-us/library/h0hfz6fc(v=vs.85).aspx 2010 .NET Framework 4 Visual Studio 2008 .NET Framework 3.5 .NET Framework 2.0 .NET Framework 1.1 Provides information about custom error messages for an ASP.NET application. The customErrors element can be defined at any level in the application file hierarchy. Copy Attributes and Elements The following sections describe attributes, child elements, and parent elements. Attributes Attribute Description defaultRedirect Optional attribute. Specifies the default URL to direct a browser to, if an error occurs. When this attribute is not specified, a generic error is displayed instead. The URL can be absolute (for example, www.contoso.com/ErrorPage.htm) or relative. A relative URL, such as /ErrorPage.htm, is relative to the Web.config file that specified the URL for this attribute, not to the Web page in which the error occurred. A URL starting with a tilde (~), such as ~/ErrorPage.htm, indicates that the specified URL is relative to the root path of the application. mode Required attribute. Specifies whether custom errors are enabled, disabled, or shown only to remote clients. This attribute can be one of the following values. Value
Web Platform Installer Get Help: Ask a Question in our Forums More Help Resources Blogs Forums HomeConfiguration Referencesystem.webServerhttpErrors HTTP Errors OverviewCompatibilitySetupHow ToConfigurationSample CodeOverviewThe element allows you to configure custom error messages for your Web site or application. Custom error messages let you https://www.iis.net/configreference/system.webserver/httperrors provide a friendly or a more informative response by serving a file, returning another resource, or redirecting to a URL when visitors to your site cannot access the content they requested. For example, you might want to customize each of the error message pages for your Web site to have the same look and feel as the rest of your site. The element contains a collection of elements, each of which defines custom error an error message that IIS uses to respond to specific HTTP errors. You can add custom error messages to IIS by adding an element to the element in the Web.config file for your site, application, or URL. Each element uses the responseMode attribute to specify whether IIS serves static content, dynamic content, or redirects to a separate URL in response to an error. You can use the element to remove custom error page a specific error message from the collection of error messages your site or application inherits from a higher level in the IIS configuration hierarchy. Also, you can use the element to remove all HTTP error messages from the collection of HTTP error messages that your site or application inherits. The element also contains attributes that configure IIS 7 to process requests that cause errors. The existingResponse attribute defines what IIS 7 does to an existing response when the server returns an HTTP error status code. The defaultPath attribute defines the path to a customer error page if you choose specify File for the responseMode attribute in an element. The detailedMoreInformationLink attribute specifies a link to more information about a particular error. The element also can contain an errorMode attribute that you can use to control the level of detail that IIS returns to a browser when an HTTP error occurs. You can set the errorMode attribute to DetailedLocalOnly, which is the default setting, or you can set it to Custom or Detailed. If you specify DetailedLocalOnly, or if you do not specify an errorMode value, IIS returns detailed error information only to the browser on the local server and a custom error message to a browser on an external computer. If you set the errorMode v