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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T13:05:35+00:00 2026-06-02T13:05:35+00:00

I am implementing custom errors in my MVC3 app, its switched on in the

  • 0

I am implementing custom errors in my MVC3 app, its switched on in the web.config:

<customErrors mode="On">
  <error statusCode="403" redirect="/Errors/Http403" />
  <error statusCode="500" redirect="/Errors/Http500" />
</customErrors>

My controller is very simple, with corresponding correctly named views:

public class ErrorsController : Controller
{
    public ActionResult Http403()
    {
        return View("Http403");
    }

    public ActionResult Http500()
    {
        return View("Http500");
    }
}

To test, I am throwing exceptions in another controller:

public class ThrowingController : Controller
{
    public ActionResult NotAuthorised()
    {
        throw new HttpException(403, "");
    }

    public ActionResult ServerError()
    {
        throw new HttpException(500, "");
    }
}

The 403 works – I get redirected to my custom “/Errors/Http403”.

The 500 does not work – I instead get redirected to the default error page in the shared folder.

Any ideas?

  • 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-02T13:05:37+00:00Added an answer on June 2, 2026 at 1:05 pm

    I’ve got 500 errors up and running by using the httpErrors in addition to the standard customErros config:

      <system.webServer>
        <httpErrors errorMode="Custom" existingResponse="Replace">
          <remove statusCode="403" subStatusCode="-1" />
          <error statusCode="403" path="/Errors/Http403" responseMode="ExecuteURL" />
          <remove statusCode="500" subStatusCode="-1" />
          <error statusCode="500" path="/Errors/Http500" responseMode="ExecuteURL" />
        </httpErrors>
      </system.webServer>
    

    And removing this line from global.asax

    GlobalFilters.Filters.Add(new HandleErrorAttribute());
    

    Its not perfect however as I’m trying to retrieve the last error which is always null.

    Server.GetLastError()
    

    See https://stackoverflow.com/a/7499406/1048369 for the most comprehensive piece on custom errors in MVC3 I have found which was of great help.

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

Sidebar

Related Questions

I need some help implementing a custom role provider in a asp.net mvc app.
I am using Pyro CMS and implementing its custom module. In this module when
I'm having a problem implementing custom 404 error pages on my Windows/IIS/PHP webhost. Whenever
I am implementing a dynamic ASMX web service via a custom HttpHandler, and my
I'm looking for some pointers on implementing Custom Events in VB.NET (Visual Studio 2008,
Implementing a custom membership provider, there are certain properties such as MinRequiredPasswordLength that only
I'm implementing a custom UIButton with minimal functionality. The .h file: #import <Foundation/Foundation.h> @interface
I am implementing a custom dialog to form an about screen with a simple
I'm implementing a custom control that inherits from Control . I want it to
I'm implementing a custom control with some labels on it and I need to

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.