Locked FxCop Custom Rule to identiy ASP Page attributes.

  • Wednesday, May 09, 2012 5:57 AM
     
     

    HI

    I am writing custom rule to check if ASP Web UI Page's attribute/property "AutoEventWireup" property set to true or false.

    Similary, how can read property or node in web.config file for my web application.

    Any help will be really appericiated?

    Thanks

    Sharad Birajdar


    sharad

All Replies

  • Wednesday, May 09, 2012 1:19 PM
     
     

    FxCop analyzes compiled IL, which doesn't include web.config contents, so this can't be done with purely built-in functionality.  However, there exists a custom FxCop rules project at http://fxcopaspnetsecurity.codeplex.com/ that includes rules for web.config contents.  These might already do what you want, or you could potentially build custom rules on top of the custom base classes that the author has created to facilitate web.config rules.  It sounds like the author might be interested in providing more rules, so there's also some chance that (s)he may be willing to include your rules in the next version (assuming one is planned).

    Nicole

  • Wednesday, May 09, 2012 1:33 PM
     
     

    Thanks Nicole for answer to my second question. I will try with custom fxcop rules project given in your link.

    Can you please help with first part. What is way in fxcop custom rule to access ASP Web UI page instance's attribute/property like "AutoEventWireup"? I want to find if this property on a page is set to true or false?

    Thanks for your help

    


    sharad

  • Wednesday, May 09, 2012 6:21 PM
     
     Answered
    If you want to do this with FxCop, you will need to run FxCop against a pre-compiled copy of the web site.  You need to look for an override of the page's SupportAutoEvents property and check the value returned from its getter.