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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:07:42+00:00 2026-06-16T00:07:42+00:00

When a new MVC3 project is created, [HandleError] attribute is by default registered as

  • 0

When a new MVC3 project is created, [HandleError] attribute is by default registered as GlobalFilter in GLobal.asax. However, if I comment it and execute following (with custom error mode on), it still works. I do see ErrorView with ErrorInfo model populated. Then what is the need for registering HandleError in Global.asax?

  [HandleError(ExceptionType = typeof(NullReferenceException),View = "ErrorView")]
        public ActionResult Index()
        {
            throw new NullReferenceException();
            return View();
        }
  • 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-06-16T00:07:43+00:00Added an answer on June 16, 2026 at 12:07 am

    That is setting the default MVC exception handling policy. It will render the /Views/Shared/Error.cshtml view when an unhandled exception arises, without you having to explicitly add the HandleError attribute on every controller or action.

    You can then add more specific HandleError attributes to your controller and\or actions, so you could display another error view than the default view or handle a more expecific exception type.

    For the HandleError filters to work (global or not), you just need to make sure the custom errors are enabled in the web.config, as in <customErrors mode="On" /> (The default is RemoteOnly, so during development they won´t be executed)

    This is nicely explained (following an example) here

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

Sidebar

Related Questions

Consider the following code (it is based on a default EMPTY MVC3 project created
As I have been following a MusicStore tutorial, new MVC3 project created a following
I'm new to mvc3. I created one web project though mvc3 . On Index
I have created a new MVC3 project and used the ADO.NET Entity Data Model
I have the following route defined in my Global.asax (MVC 3 web project): routes.MapRoute(
I created a new MVC3 project, hit F5, saw the sample page. Then I
I created a new MVC3 project in VS 2010. Made no changes and started
I am completely new to ASP.Net MVC. I just created an MVC3 project in
I just created a new project in MVC3 using EF4 code first deployed on
I am using MS Visual Studio 2010. When i create a new MVC3 project

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.