Get Action and Action Parameters in Controller.OnException
protected override void OnException(ExceptionContext filterContext)
{
string action = filterContext.RouteData.Values["action"].ToString();
string controller = filterContext.RouteData.Values["controller"].ToString();
}
You can get all these data from ExceptionContext
object.
For example using this code you can get controller, action and all other routing parameters:
context.RouteData.Values
Using this code you can get query string parameters:
context.HttpContext.Request.QueryString
And finnaly form parameters:
context.HttpContext.Request.Form