Exemple #1
0
		public static Type GetCompiledType (HttpContext context, string virtualPath, string physicalPath)
		{
			WebHandlerParser parser = new WebHandlerParser (context, virtualPath, physicalPath);
			Type type = parser.GetCompiledTypeFromCache ();
			if (type != null)
				return type;

			return WebServiceCompiler.CompileIntoType (parser);
		}
        public static Type GetCompiledType(HttpContext context, string virtualPath, string physicalPath)
        {
            WebHandlerParser parser = new WebHandlerParser(context, virtualPath, physicalPath);
            Type             type   = parser.GetCompiledTypeFromCache();

            if (type != null)
            {
                return(type);
            }

            return(WebServiceCompiler.CompileIntoType(parser));
        }
Exemple #3
0
        public virtual IHttpHandler GetHandler(HttpContext context, string requestType,
                                               string virtualPath, string path)
        {
            // Parse and (possibly) compile the file into a type
            Type t = WebHandlerParser.GetCompiledType(virtualPath, path, context);

            // Make sure the type has the correct base class (ASURT 123677)
            Util.CheckAssignableType(typeof(IHttpHandler), t);

            // Create an instance of the type
            Object obj = HttpRuntime.CreateNonPublicInstance(t);

            return((IHttpHandler)obj);
        }
        public virtual IHttpHandler GetHandler(HttpContext context,
                                               string requestType,
                                               string virtualPath,
                                               string path)
        {
#if NET_2_0
            return(BuildManager.CreateInstanceFromVirtualPath(virtualPath, typeof(IHttpHandler)) as IHttpHandler);
#else
            Type type = WebHandlerParser.GetCompiledType(context, virtualPath, path);
            if (!(typeof(IHttpHandler).IsAssignableFrom(type)))
            {
                throw new HttpException("Type does not implement IHttpHandler: " + type.FullName);
            }

            return(Activator.CreateInstance(type) as IHttpHandler);
#endif
        }
        /// <include file='doc\SimpleWebHandlerParser.uex' path='docs/doc[@for="WebHandlerParser.GetCompiledType"]/*' />
        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        internal static Type GetCompiledType(string virtualPath, string physicalPath, HttpContext context)
        {
            WebHandlerParser parser = new WebHandlerParser(context, virtualPath, physicalPath);

            return(parser.GetCompiledTypeFromCache());
        }