We're using the OnException virtual method in BaseController to log our exception.
But how can we get the controller action and parameters that the exception originated from?
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With