2007-05-06 Igor Zelmanovich <igorz@mainsoft.com>
[mono.git] / mcs / class / System.Web / System.Web.Configuration_2.0 / HttpHandlerAction.cs
index 450dd6520622ae45e1d101b756761408fc05fc90..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;
 
@@ -59,8 +61,8 @@ namespace System.Web.Configuration
                        validateProp = new ConfigurationProperty ("validate", typeof (bool), true);
                        verbProp = new ConfigurationProperty ("verb", typeof (string), null,
                                                              TypeDescriptor.GetConverter (typeof (string)),
-                                                             PropertyHelper.NonEmptyStringValidator,
-                                                             ConfigurationPropertyOptions.IsRequired);
+                                                             PropertyHelper.NonEmptyStringValidator,\r
+                                                             ConfigurationPropertyOptions.IsRequired | ConfigurationPropertyOptions.IsKey);
 
                        _properties = new ConfigurationPropertyCollection ();
                        _properties.Add (pathProp);
@@ -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;