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 }