0

I would like to achieve something to this extent:

  1. I want to audit all of my controllers participating in serving http requests to the view files.

  2. I would like to audit each and every method on that controller and write this information to the flat file (rolling logger??).

  3. The audit log should contain: authenticated user info, method called, method parameters, time stamp.

I realize that this would require implementing my own controller factory to do something like this:

    //policy injection call that is set up to log all the methods, called on the 
   //controller.
   var myController = ControllerCustomerFactory<FlatRollingLogger>.Create();

what should I do next, should I inject the custom created controller somewhere else or the factory will keep track on which controller needs to be instantiated?

I was thinking Microsoft Ent Lib Policy Injection as it has been done for other auditing purposes in our company?

Any other better ideas to handle this?

merci

1
  • 2
    Why not use a global filter and log all that stuff OnActionExecuting Commented Nov 17, 2011 at 22:06

2 Answers 2

3

No, you don't need your own factory controller, just create a global action filter. MVC is very extensible.

http://weblogs.asp.net/gunnarpeipman/archive/2010/08/15/asp-net-mvc-3-global-action-filters.aspx

Sign up to request clarification or add additional context in comments.

Comments

1

You might want to consider an aspect oriented approach using a framework such as PostSharp. You can use a logging framework such as log4net to perform the actual logging.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.