Using a custom attribute in aspx pages
- From: hardieca@xxxxxxxxxxx
- Date: Mon, 16 Jul 2007 09:24:07 -0700
Hi!
I have built a custom attribute that tracks my list of things left to
do in my application:
[ToDo("hardie.ca", "2007-07-16", Comment:="Fix recursion")]
Public Class SomeClass ...
Using reflection, I am able to find all attributes within the App_Code
folder:
Assembly a = Assembly.Load("__code")
string alltypes = "";
Type[] types = a.GetTypes();
foreach (Type t in types) {
MemberInfo inf = t;
object[] attributes;
attributes = inf.GetCustomAttributes(typeof(ToDoAttribute), false);
foreach (object attribute in attributes) {
ToDoAttribute todo = (ToDoAttribute)attribute;
alltypes += "<p>" + t.ToString() + "<br>";
alltypes += "Programmer: " + todo.Programmer + "<br>";
alltypes += "Date: " + todo.LogDate + "<br>";
alltypes += "Comments: " + todo.Comment + "</p>";
}
}
My problem is I would like to decorate the classes of Aspx pages, but
because they don't reside within the App_code folder, I can't get a
reference to their assembly. Is there some way to do this?
Thanks,
Chris
.
- Follow-Ups:
- Re: Using a custom attribute in aspx pages
- From: Nicholas Paldino [.NET/C# MVP]
- Re: Using a custom attribute in aspx pages
- Prev by Date: Re: migrate from .Net 2.0 to .Net 3.0
- Next by Date: Re: Using a custom attribute in aspx pages
- Previous by thread: PropertyGrid Discard values
- Next by thread: Re: Using a custom attribute in aspx pages
- Index(es):
Relevant Pages
|