Exemple #1
0
        /* stolen from the 1.0 S.W.Config ModulesConfiguration.cs */
        internal HttpModuleCollection LoadModules(HttpApplication app)
        {
            HttpModuleCollection coll = new HttpModuleCollection();
            Type type;

            foreach (HttpModuleAction item in Modules)
            {
                type = HttpApplication.LoadType(item.Type);

                if (type == null)
                {
                    /* XXX should we throw here? */
                    continue;
                }
                IHttpModule module = (IHttpModule)Activator.CreateInstance(type,
                                                                           BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance,
                                                                           null, null, null);
                module.Init(app);
                coll.AddModule(item.Name, module);
            }

            /* XXX the 1.x config stuff does this
             * indirectly..  I'm not sure we want to do it
             * here, but this keeps things working in much
             * the same fashion in 2.0-land. */
            {
                IHttpModule module = new DefaultAuthenticationModule();
                module.Init(app);
                coll.AddModule("DefaultAuthentication", module);
            }

            return(coll);
        }
 public void Module()
 {
     // only the ctor requires UnmanagedCode
     module.Init(app);
     module.Authenticate += new DefaultAuthenticationEventHandler(Authenticate);
     module.Authenticate -= new DefaultAuthenticationEventHandler(Authenticate);
     module.Dispose(); // but doesn't implement IDisposable
 }