Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 972197
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T03:05:08+00:00 2026-05-16T03:05:08+00:00

I have ASP.NET set up to use the CustomErrors functionality: <customErrors mode=On defaultRedirect=~/ErrorPages/500.aspx redirectMode=ResponseRewrite>

  • 0

I have ASP.NET set up to use the CustomErrors functionality:

<customErrors mode="On" defaultRedirect="~/ErrorPages/500.aspx" redirectMode="ResponseRewrite">
    <error statusCode="404" redirect="~/ErrorPages/404.aspx" />
    <error statusCode="500" redirect="~/ErrorPages/500.aspx" />
</customErrors>

Everything works nice, and the relevant error pages are shown when appropriate.

Except in the following two cases:

1) When there is an exception thrown in global.asax:

public class MvcApplication : System.Web.HttpApplication
{
    protected void Application_Start()
    {
        throw new ApplicationException("Exception in Application_Start()");
    }
}

2) When there is a syntax error in web.config

In both cases, I don’t see my pretty 500.aspx page. Instead, I see the standard ASP.NET yellow screen of death, with the following message:

Server Error in ‘/MvcErrorHandling’ Application.
Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed.

How can I get ASP.NET or IIS to show a custom error page (a pretty one, instead of the YSOD) in the above two scenarios?

Thanks in advance for any input 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T03:05:09+00:00Added an answer on May 16, 2026 at 3:05 am

    The problem is that those specific errors are happening before ASP.NET can load things up, and your “500 internal server error” page is an .aspx page that requires ASP.NET to load.

    The simplest option would be to make your 500 page an HTML page, but that would mean you can’t do simple error logging, etc from there.

    This may still not help the web.config scenario as if IIS can’t process the web.config, there’s no guarantee that it would read your error section.

    Another option would be to tell IIS to serve a static html page on 500 errors.

    Finally you could try catching errors in the Application_Error event in the web.config – this would at least allow you to process the error, even if the page you try to display can’t load up.


    Edit to add

    If you’re running IIS 7 in integrated mode, you need to do one more thing if you’re setting the response code of your error page to 500:

    Response.TrySkipIisCustomErrors = true;
    

    However, note that the following conditions will stop any custom 500 error page from displaying, resulting in the YSOD:

    1. Errors in the web.config or certain handlers in the web.config that fire before the rest of the pipeline (i.e. the bulk of the original answer)
    2. Errors in the error page.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have set up my website to use ASP.NET Membership. it all works fine
I have an ASP.NET page with a listbox whose selection mode is set to
I have an ASP.NET web site set up to use windows authentication (not sure
I have an ASP.NET website set up, and I'm using Google Analytics for page
We have an ASP.net 2.0 web application which is using themes set on the
I have set in my mastersite of my asp.net application the following that the
I have an image in a repeater in ASP.NET. I need to set the
I'm using ASP.NET MVC RC2. I have a set of classes that were auto-generated
I have asp.net Web services, and I use them in my site using JS
I have an ASP.NET user control that is used in another use control. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.