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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:35:28+00:00 2026-05-23T11:35:28+00:00

what is the best way to create custom error pages in ASP.NET MVC 3?

  • 0

what is the best way to create custom error pages in ASP.NET MVC 3? The one I am particularly interested in is a 404 error, but also 403, and others. I am new to the MVC framework, traditionally I come from a PHP background, but am learning quickly.

I did my research before posting this question and came across this link:
Custom error pages on asp.net MVC3

That solution seems simple although when I try to implement that on my machine, I get a problem with the following line: IController errorsController = new ErrorsController(); inside the Application_Error() function. It says “The type or namespace name ‘ErrorsController’ could not be found (are you missing a using directive or an assembly reference?”.

Thank you in advance for help you may provide.

  • 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-23T11:35:28+00:00Added an answer on May 23, 2026 at 11:35 am

    You should configure

    <httpErrors>
    

    section under

    <system.webServer> 
    

    section group in your web.config file.

    Please refer to this article:

    http://www.iis.net/ConfigReference/system.webServer/httpErrors

    Additionally you can use the error controller which you linked in your question, however initial flow should be managed by IIS. By this section you can instruct IIS that it should execute urls which are managed by your controller.

    Also please take care about proper Response.Status property string in your controller’s actions as proposed solution returns “200 OK” which may be confusing for browsers. For example

    public class ErrorsController : Controller
    {
        public ActionResult NotFound()
        {
            Response.Status = "404 Not Found";
            return View();
        }
    
        public ActionResult ServerError()
        {
            byte[] delay = new byte[1];
            RandomNumberGenerator prng = new RNGCryptoServiceProvider();
    
            prng.GetBytes(delay);
            Thread.Sleep((int)delay[0]);
    
            IDisposable disposable = prng as IDisposable;
            if (disposable != null) { disposable.Dispose(); }
            Response.Status = "500 Internal Server Error";
            return View();
        }
    
    }
    

    Configuration example:

    <httpErrors defaultPath="/error.htm" errorMode="Custom" existingResponse="Replace" defaultResponseMode="ExecuteURL">
          <remove statusCode="500" subStatusCode="-1" />
          <remove statusCode="404" subStatusCode="-1" />
          <error statusCode="500" path="/errors/servererror/" responseMode="ExecuteURL" />
          <error statusCode="404" path="/errors/notfound/" responseMode="ExecuteURL" />
      </httpErrors>
    

    You can control 404.3 and other using “subStatusCode” attribute.

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

Sidebar

Related Questions

In my ASP.NET MVC 2 web application, I allow users to create custom input
What is the best way to create a custom title for pages in a
What is the best way to create a custom UIView that I can consume
I'm looking for the best way to create a custom border around an HTML
What is the best way to create a custom document editor in GAE? I'm
What is the best way to create a custom skin for an application the
Looking for some help on the best way to create a custom UIActivityIndicator. I
What will be the best possible way to create Custom Scrollbars using Javascript? Thanks
What is the best way to create an NSButton with a custom background image,
What is best way to create a blinking image animation in wp7? Is there

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.