handleerror

attribute does not seem to act at all

我是研究僧i 提交于 2019-11-29 03:54:56
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 a couple of other threads on the subject here on SO, and in most cases it seems that setting the customErrors option to On in web.config solved the problem. It has not for me, so I need to find a different solution. My controller action: [HandleError] public

How do I pass ViewData to a HandleError View?

不羁的心 提交于 2019-11-28 23:01:05
问题 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 Action method on every controller in my solution. [HandleError(ExceptionType=typeof(MyException), View="MyErrorView")] public abstract class SiteController :

ASP.net MVC [HandleError] not catching exceptions

孤人 提交于 2019-11-28 06:12:47
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.NET MVC!"; throw new Exception(); return View(); } public ActionResult About() { return View(); } } which is just the default controller with an exception being thrown for testing. But it doesn't work. Instead of going to the default error.aspx page it shows the debug information

When was handleError removed from jQuery?

只谈情不闲聊 提交于 2019-11-28 02:44:34
问题 I'm revisiting some old code, and have found it doesn't work with jQuery 1.6 because it cannot find $.handleError() . A quick search of the jQuery code shows nothing, so I guess this function has been removed/replaced. Does anyone know which version the handleError function was first missing from, and if it has a direct replacement? 回答1: It looks like handleError() was removed in jQuery 1.5. Most solutions I've seen online create their own error functions. Hope that helps 来源: https:/

ASP.NET MVC user friendly 401 error

不想你离开。 提交于 2019-11-27 19:48:21
I have implemented errors handling in ASP.NET MVC site in a way like suggests this post . With 404 errors all works fine. But how correctly show user friendly screen for a 401 error ? They usually do not throw Exception that can be handled inside Application_Error() but rather action returns HttpUnauthorizedResult. One possible way is to add following code to the end of Application_EndRequest() method if (Context.Response.StatusCode == 401) { throw new HttpException(401, "You are not authorised"); // or UserFriendlyErrorRedirect(new HttpException(401, "You are not authorised")), witout

attribute does not seem to act at all

时光怂恿深爱的人放手 提交于 2019-11-27 17:55:51
问题 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 a couple of other threads on the subject here on SO, and in most cases it seems that setting the customErrors option to On in web.config solved the problem. It

ASP.net MVC [HandleError] not catching exceptions

末鹿安然 提交于 2019-11-27 05:38:42
问题 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.NET MVC!"; throw new Exception(); return View(); } public ActionResult About() { return View(); } } which is just the default controller with an exception being thrown for

ASP.NET MVC HandleError

和自甴很熟 提交于 2019-11-26 03:02:52
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 Class like this: [HandleError] public class DSWebsiteController: Controller { [snip] public ActionResult CrashTest() { throw new Exception("Oh Noes!"); } } Then I let my controllers inherit from this class and call CrashTest() on them. Visual studio halts at the error

ASP.NET MVC HandleError

混江龙づ霸主 提交于 2019-11-26 01:12:37
问题 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 Class like this: [HandleError] public class DSWebsiteController: Controller { [snip] public ActionResult CrashTest() { throw new Exception(\"Oh Noes!\"); }