Is there a way to get the HTTP status code from MVC action from OnActionExecuted
, without using the session variables?
There are a few ways to access it. Mainly via the ActionExecutedContext
which inherits from ControllerContext
protected override void OnActionExecuted(ActionExecutedContext filterContext) {
var statusCode = filterContext.HttpContext.Response.StatusCode;
}
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