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 893427
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T14:13:13+00:00 2026-05-15T14:13:13+00:00

I’m having an issue with exceptions showing app as stack traces in the page.

  • 0

I’m having an issue with exceptions showing app as stack traces in the page.

I thought that I had mitigated this by adding this to the web.config:

<customErrors mode="On" defaultRedirect="~/error/GenericError">
    <error statusCode="403" redirect="~/error/NoAccess" />
    <error statusCode="404" redirect="~/error/NotFound" />
</customErrors>

It works for non-existent routes, but not when a controller throws an exception. Here’s the Controller logic:

[HandleError]
public class DebugController : Controller
{      
    public ActionResult Index()
    {
        throw new Exception("** Testing custom error Handling **");
        return View();
    }
}



public class ErrorController : Controller
{
    //
    // GET: /Error/

    public ActionResult NotFound()
    {
        ViewData["error"] = "That page does not exist.";
        return View();
    }

    public ActionResult GenericError()
    {
        if (null == TempData["error"]))
        {
            ViewData["error"] = "We're sorry, but an error has occurred.";
        }
        else
        {
            ViewData["error"] = TempData["error"];
        }

        return View();
    }

    public ActionResult NoAccess()
    {
        ViewData["error"] = "You are not authorized to access application";
        return View();
    }

}

And here’s the View:

<%@ Page Title="" Language="C#"
    MasterPageFile="~/Views/Shared/CenterContentNoSidebar.Master"
    Inherits="System.Web.Mvc.ViewPage<System.Web.Mvc.HandleErrorInfo>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
GenericError
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h2>An Error has occurred</h2>
    <br />
    <%= ViewData["error"] %>
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="NavContent" runat="server">
</asp:Content>

Do I have to put something in the Global.asax to make this work?

  • 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-15T14:13:14+00:00Added an answer on May 15, 2026 at 2:13 pm

    So The HandleError Attribute is actually handling the error and trying to return an Error.aspx view from the controllers view folder or the shared location. The customErrors web.config section is never being hit, and since the page might not exist the yellow screen of death is being displayed anyways. The non-existent routes is working cause IIS is throwing a 404 error and has no context of a controller or HandleError attribute. If you want to handle the errors yourself I would suggest removing the HandleError attributes and let the customErrors some through. From your error controller though you would have to grab the last exception though and do something with it. Here is a good reference on what I am talking about a little.

    http://blog.dantup.com/2009/04/aspnet-mvc-handleerror-attribute-custom.html

    It is kind of a one or the other type of thing, HandleError attribute or customErrors web.config section.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 447k
  • Answers 447k
  • 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 Enumerable.SequenceEquals if they're supposed to be in the same order. May 15, 2026 at 7:36 pm
  • Editorial Team
    Editorial Team added an answer I don't know of any way to do this. You'll… May 15, 2026 at 7:36 pm
  • Editorial Team
    Editorial Team added an answer I think maybe you mean temporal difference learning. Edit As… May 15, 2026 at 7:36 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

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.