For a specific set of actions, I need to register incoming InputStream requests, as well as outgoing Response.OutputStream.
I suggest using ActionFilterAttribute for this and overriding the OnActionExecuted and OnResultExecuted methods.
So, I start with this idea ...
public class ActionLoggerAttribute : ActionFilterAttribute
{
public override void OnActionExecuted(ActionExecutedContext filterContext)
{
base.OnActionExecuted(filterContext);
HttpRequestBase request = filterContext.HttpContext.Request;
}
public override void OnResultExecuted(ResultExecutedContext filterContext)
{
base.OnResultExecuted(filterContext);
HttpResponseBase response = filterContext.HttpContext.Response;
}
}
Ideally, I just connect this to the Enterprise Library journal, as I already use it to log errors.
- Am I accessing input and output streams at the appropriate time?
- Can I use the corporate library to easily record streams?
- Is there a completely different and better solution to my problem?
Thank!