Click here to Skip to main content
15,879,535 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,
Can you please help how to access properties defined in customfilterattribute in controller?

C#
public class TestFilterAttribute : ActionFilterAttribute
   {
       public bool IsAccessable { get; set; }


TestController

C#
[TestFilterAttribute]
        public ActionResult Index(int? id)
        {
}



I want to access the property(IsAccessable)in Index method of controller.

how is that possible?
Posted
Comments
Jameel VM 18-Aug-14 9:56am    
why u are accessing it in index? because you can check it before this action is execute
Jameel VM 18-Aug-14 9:58am    
if u want it, Create another class with a static boolean property and set the value in action filter and then try to access it in index method like NewClass.YourBooleanProperty

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900