2007-05-06 Igor Zelmanovich <igorz@mainsoft.com>
[mono.git] / mcs / class / System.Web / System.Web.Configuration_2.0 / HttpHandlerAction.cs
index a108f5c0ab2716def012c1c886237bf24159c3f5..cff9ad214dd4d08fd357537a4aeb0b5125e25333 100644 (file)
 #if NET_2_0
 
 using System;
+using System.Collections;
 using System.ComponentModel;
 using System.Configuration;
+using System.Reflection;
 using System.Text.RegularExpressions;
 using System.Web.Util;
 
@@ -175,14 +177,25 @@ namespace System.Web.Configuration
                //
                internal static Type LoadType (string type_name)
                {
-                       Type t;
+                       Type t = null;
                        
-                       try {
-                               t = System.Type.GetType (type_name, true);
-                       } catch (Exception e) {
-                               throw new HttpException (String.Format ("Failed to load httpHandler type `{0}'", type_name), e);
+                       t = System.Type.GetType (type_name, false);
+                       if (t == null) {
+                               IList tla = System.Web.Compilation.BuildManager.TopLevelAssemblies;
+                               if (tla != null && tla.Count > 0) {
+                                       foreach (Assembly asm in tla) {
+                                               if (asm == null)
+                                                       continue;
+                                               t = asm.GetType (type_name, false);
+                                               if (t != null)
+                                                       break;
+                                       }
+                               }
                        }
 
+                       if (t == null)
+                               throw new HttpException (String.Format ("Failed to load httpHandler type `{0}'", type_name));
+
                        if (typeof (IHttpHandler).IsAssignableFrom (t) ||
                            typeof (IHttpHandlerFactory).IsAssignableFrom (t))
                                return t;