handleerror

ASP.NET MVC HandleError

How do I go about the [HandleError] filter in asp.net MVC Preview 5? I set the customErrors in my Web.config file <customErrors mode="On" defaultRedirect="Error.aspx"> <error statusCode="403" redirect="NoAccess.htm"/> <error statusCode="404" redirect="FileNotFound.htm"/> </customErrors> and put [HandleError] above my Controller Cl...

MVC Beta [HandleError] Attribute (need help)

I've tried this both with and without the 'ExceptionType' parameter. I have an Error.aspx page in both the Views/Shared folder and the Views/thisController folder. But everytime I run this I get a "Server Error in '/' Application." error page, rather than the nice one in Views/Shared. Any idea what could be going wrong here? [HandleErr...

ASP.Net MVC HandleError throwing 500 Internal Server Error

Hi folks I have the following HandleError filter on my controller: [HandleError(ExceptionType = typeof(ArgumentException), View = "DestinationError")] I've set-up the Web.Config so that customErrors are on. The problem I'm having is that the HandleError filter is working fine, when I run the app locally out of Visual Studio, but when...

[HandleError] attribute does not seem to act at all...

I am having problems using the [HandleError] attribute on my Controller Actions - it doesn't seem to work at all (i.e. it doesn't matter if the filter is there or not - I get the same results...). When an Exception is thrown, I get the standard red-toned Server Error in '/' Application error page instead of my custom view. I have found ...

ASP.net MVC [HandleError] not catching exceptions.

In two different application, one a custom the other the sample MVC application you get with a new VS2008 MVC project, [HandleError] is not catching exceptions. In the sample application I have: [HandleError] public class HomeController : Controller { public ActionResult Index() { ViewData["Message"] = "Welcome to ASP....

ASP.NET MVC HandleError not working (customErrors is set to "On")

I believe I have set up our MVC app to use [HandleError] properly. This is my controller: [HandleError] public class SupportController : BaseController { public ActionResult Toss() { throw new Exception("uh oh"); } // snip } And I have set my customErrors tag in web.config to "On": <customErrors mode="On"></custo...

ASP.NET MVC Error Handling - View never renders, Web.config problem?

I have a [HandleError] attribute specified atop one of my controllers, specifying a View that I'd like to render in the event of an error. I also have the following config section in my web.config: <customErrors mode="On"> <error statusCode="404" redirect="~/Error/NotFound"/> <error statusCode="500" redirect="~/Error/Unknow...

ASP.NET MVC user friendly 401 error

Hello. I have implemented errors handling in ASP.NET MVC site in a way like suggests this post: http://stackoverflow.com/questions/619895/how-can-i-properly-handle-404s-in-asp-net-mvc/620559#620559. With 404 errors all works fine. But how correctly show user friendly screen for 401 error? They usually do not throw Exception that can be ...

How do I pass ViewData to a HandleError View?

In my Site.Master file, I have 3 simple ViewData parameters (the only 3 in my entire solution). These ViewData values are critical for every single page in my application. Since these values are used in my Site.Master, I created an abstract SiteController class that overrides the OnActionExecuting method to fill these values for every Ac...

ASP.NET MVC HandleError and Order of Operations with other Attributes

Hi guys, I'm trying to get the HandleError attribute to work, but I'm having some difficulty because of a sort of a special circumstance. I have another attribute which checks against a blacklist of IPs in my database and quite literally throws an exception. I was hoping to catch that exception with the HandleError attribute and route ...

In ASP.NET MVC, why wouldn't I tack on HandleError on a base controller and be done with it?

Since HandleError is inherited by the derived Controllers, why wouldn't I just create (or have) a base controller, and apply HandleError on it so that any controllers that inherits from the base controller will automatically be handled as well? And then I would tack on overriding HandleError on controllers and individual actions. Can a...

How can I make HandleErrorAttribute work with Ajax?

In my ASP.NET MVC 2 application I use HandleErrorAttribute to display a custom error page in case of unhandled exceptions, and it works perfectly unless the exception happens in an action called by Ajax.ActionLink. In this case nothing happens. Is it possible to use HandleErrorAttribute to update the target element with the contents of a...

ASP.NET MVC - How to throw a 404 page similar to that on StackOverflow.

I've currently got a BaseController class that inherits from System.Web.Mvc.Controller. On that class I have the HandleError Attribute that redirects users to the "500 - Oops, we screwed up" page. This is currently working as expected. THIS WORKS <HandleError()> _ Public Class BaseController : Inherits System.Web.Mvc.Controller ''...

Trouble with HandleError

I have the following Action Method: [HandleFtmsError] public ActionResult PerformanceChart(ChartViewModel chart) { var x = 1; var y = 0; var z = x/y; return Json(""); } where HaneleFtmsError is defined as: public class HandleFtmsErrorAttribute : System.Web.Mvc.HandleErrorAttribute { ...