Using a custom attribute in aspx pages

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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

.



Relevant Pages

  • Re: Convert IEnumerable to DataTable?
    ... If you want to do it in a general way that will be valid for any IEnumerable, you will have to use Reflection on the returned objects to find out their properties and then create a datatable with columns of the same type, and then use Reflection again to get the values and add them to the columns of each row. ... foreach (PropertyInfo pi in pis) ...
    (microsoft.public.dotnet.languages.csharp)
  • ContextSwitchDeadlock
    ... It navigates a folder tree of N-Levels and it moves all the files from each folder to the root folder, ... foreach ) ... The CLR has been unable to transition from COM context 0x1f6050 to COM context 0x1f61c0 for 60 seconds. ... The thread that owns the destination context/apartment is most likely either doing a non pumping wait ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Windows Service "Start In" Folder
    ... Nicholas Paldino [.NET/C# MVP] wrote: ... Instead of looking at the start in folder, why not look for the location of the assembly using reflection, then use that for your relative file paths? ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Recursive Reading : Corrected
    ... It might take you a while but you'll probably see how the folder tree is ... protected void MessContents(DirectoryInfo root) ... foreach ) ... foreach (FileInfo NextFile in root.GetFiles()) ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Set a foreach to a file connection
    ... Create a string variable with the original file folder path you need. ... Within the ForEach Loop Editor choose to set an expression. ... So I am in SQL Server Business Intelligence Development Studio 2008. ...
    (microsoft.public.sqlserver.datawarehouse)