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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T18:40:18+00:00 2026-06-12T18:40:18+00:00

Okay, so I am trying to get my controller to go to the Error.cshtml

  • 0

Okay, so I am trying to get my controller to go to the Error.cshtml under the Shared folder on error. I’ve got the filter configured at startup:

Global.asax

protected void Application_Start()
{
    ...
    FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
    ...
}

FilterConfig.cs

public static void RegisterGlobalFilters(GlobalFilterCollection filters)
{
    filters.Add(new HandleErrorAttribute());
}

HomeController.cs

[HandleError(View = "Error")] <---- I have the HandleError attribute
public class HomeController : Controller
{
    IDbConnection _connection = new SqlConnection(ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString);

    [Authorize]
    public ActionResult Index()
    {
        // get the users current events
        try
        {
            ViewBag.UserEvents = _connection.Query<MyEvents>("select ...)", new { });
        }
        catch (Exception ex)
        {
            throw new HttpException(500, ex.Message);
        }

        return View();
    }
    ...
}

And so when the Index method is throwing an exception because I didn’t open the connection, it just gives me the default ASP.NET exception page. What did I miss here?

Thanks!

  • 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-12T18:40:19+00:00Added an answer on June 12, 2026 at 6:40 pm

    Are you by any chance running this on your local machine? HandleError by default doesn’t show errors on the local machine if you have customErrors set to Off or RemoteOnly. Set it to On.

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

Sidebar

Related Questions

Okay...so, I've got everything written correctly...however, when trying to get the grand total of
Okay, I'm trying to get ActionBarSherlock working, so I imported the library by: Creating
Okay, so I am trying to wrap my head around how to get stuff
I'm trying to get my head round this (okay, tbh cramming a night before
Okay, so I'm trying to get into this whole HTML 5 thing, and this
I am trying to get my svc file working under IIS. In my project,
Okay, so I'm trying to create a Call class on top of my Controller,
Okay so I have been trying to get into IoC lately. However, I keep
Okay... I'm getting kind of desperate trying to get this code to work with
Okay I am trying to make a partial view and controller whose job it

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.