private IRewriter LoadAssembly(string typeFullName, RewriteRuleCollection rules) { System.Diagnostics.Debug.Assert(!string.IsNullOrEmpty(typeFullName)); string assemblyName = typeFullName.Substring(typeFullName.IndexOf(',') + 1); string typeName = typeFullName.Substring(0, typeFullName.IndexOf(',')); try { Assembly assembly = Assembly.Load(assemblyName); Type type = assembly.GetType(typeName); var instance = (IRewriter)Activator.CreateInstance(type, rules); if (instance == null) throw new ApplicationException(string.Format("{0}, {1} doesn't inherit from {2}", typeName, assembly, "IRewriter")); return instance; } catch (Exception ex) { throw new ApplicationException("Failed to load handler", ex); } }
public HTMLRewriterHandler(RewriteRuleCollection rules) { _rules = rules; }