asp.net mvc 4 - C# throws exception and redirect back to controller with RedirectToRouteResult gives me unlimited loop -
public class userfriendlyexceptionhandler : handleerrorattribute { public override void onexception(exceptioncontext filtercontext) { ... var area = filtercontext.controller.controllercontext.routedata.datatokens["area"]; var controller = filtercontext.controller.controllercontext.routedata.values["controller"]; var action = filtercontext.controller.controllercontext.routedata.values["action"]; namevaluecollection querystring = filtercontext.httpcontext.request.querystring; routevaluedictionary redirecttargetdictionary = querystring.toroutevaluedictionary(); redirecttargetdictionary.add("area", area); redirecttargetdictionary.add("controller", controller); redirecttargetdictionary.add("action", action); filtercontext.result = new redirecttorouteresult(redirecttargetdictionary); ... }
when getting exception in update or insert want print exception , redirect same controller, problem filtercontext.result
redirected right controller query parameters getting unlimited loop. controller , exception, controller , exception,...
why? how can controller if error thrown?
c# asp.net-mvc-4
No comments:
Post a Comment