action filter - ASP.NET MVC - Access a controller property in an ActionFilter -


I use Unity to instantiate a new class in the controller constructor and save the injection class in an asset inside the controller. I am doing Then I want to use an action filter to see if there are some properties in the injection class that I accept it inside the constructor. So is there any way to use the actionfilter to validate the properties of the injection class?

In advance thanks

something like this ?:

 Public class valid ActionFilterAttivat: ActionFilterArrbit {Public Override Zero Onset Exposing (Action Accepting Contact Filter Context) {var YourController = filterContext.Controller YourController; If (your controller == empty) {new invalid operation expiation ("this is not your controller !!!"); } // This is your controller - here you can verify that your property is = yourController.YourProperty; // UPDATED ********************************************************* Property Properties of the Controller Property = filterContext.Controller.GetType (). ("own property"); If (property == faucet) {new invalid operation exception ("you have no answer !!!"); }}}  

Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -