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

  • Home
  • SEARCH
  • 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

Ask A Question

Stats

  • Questions 509k
  • Answers 509k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I have tried the solution given by this article (Thanks… May 16, 2026 at 4:31 pm
  • Editorial Team
    Editorial Team added an answer Also having the same issue here. I think the reason… May 16, 2026 at 4:31 pm
  • Editorial Team
    Editorial Team added an answer The closest equivalent seems to be sqlsrv_get_field(). See here for… May 16, 2026 at 4:31 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

Just starting with ASP.NET and find it difficult to use the GridView. I have
I have an asp.net project in visual studio 2008 I press F5 and the
Ok I have a Asp .net 3.5 Website in IIS6 on Windows Server 2003
I would really like use the jQuery Validation plugin in my ASP.NET Web Forms
I have an ASP.NET page that requires data from another DLL and the process
I have ASP.Net code similar to the following (this is inside a FIELDSET): <ol>
Say I have a User Control in ASP.NET that contains a button: public class
Having a weird problem here. Everybody knows that if you use web.config's customErrors section
Let's say I have some Classic ASP pages that produce all output via Response.Write.
I'm trying out the Razor ViewEngine from ASP.NET MVC 3 Preview 1 and I'm

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.