Example #1
0
        internal HandlerFactoryCache(HandlerMapping mapping)
        {
            Object instance = mapping.Create();

            // make sure it is either handler or handler factory

            if (instance is IHttpHandler)
            {
                // create bogus factory around it
                _factory = new HandlerFactoryWrapper((IHttpHandler)instance, mapping.Type);
            }
            else if (instance is IHttpHandlerFactory)
            {
                _factory = (IHttpHandlerFactory)instance;
            }
            else
            {
                throw new HttpException(HttpRuntime.FormatResourceString(SR.Type_not_factory_or_handler, instance.GetType().FullName));
            }
        }