I have an MVC 3 Application which has JSON POST’ed to an Action. Everything works fine, but I need to start logging the raw inbound JSON blobs (or whatever else is being sent). Specifically, I want to capture requests that fail before hitting the target Action so I can analyze structural and/or content issues with the data being POST’ed.
Is something like this possible in MVC 3?
If you want to analyze eveything, that comes to server, consider using HTTP module: http://msdn.microsoft.com/en-us/library/ms227673.aspx.
HTTP Module is a class, that allows you to attach additional actions to existing request flow. You can attach your code to BeginRequest event to log request details, even if it won’t reach controller.