Add Attribute (System.Attribute variety) to .aspx page - not the code-behind

Posted by Macho Matt on Stack Overflow See other posts from Stack Overflow or by Macho Matt
Published on 2009-04-24T15:54:57Z Indexed on 2010/05/18 13:30 UTC
Read the original article Hit count: 214

Filed under:

I am creating a custom Attribute (extending System.Attribute). I know I can put it on another class easily enough by doing the following.

[MattsAttribute]
public class SomeClassWhichIsACodeBehind {

However, I need to be able to test this attribute easily, and putting it in the code-behind would cause a lot of extra effort to get it deployed to an environment which would respond to the behavior of attribute.

What I would like to do: declaratively apply this attribute to the .aspx page itself (which is really just another class that inherits from the code-behind). Is this possible? If so, what is the proper syntax for doing this?

© Stack Overflow or respective owner

Related posts about ASP.NET