Create() public static méthode

public static Create ( IEnumerable resourceNames, string mediaType ) : Action
resourceNames IEnumerable
mediaType string
Résultat Action
        private static IHttpHandler FindHandler(string name)
        {
            Debug.Assert(name != null);

            switch (name)
            {
            case "detail":
                return(CreateTemplateHandler <ErrorDetailPage>());

            case "html":
                return(new ErrorHtmlPage());

            case "delete":
                return(new DelegatingHttpHandler(ErrorDeletionHandler.ProcessRequest));

            case "truncate":
                return(new DelegatingHttpHandler(ErrorTruncationHandler.ProcessRequest));

            case "xml":
                return(new DelegatingHttpHandler(ErrorXmlHandler.ProcessRequest));

            case "json":
                return(new DelegatingHttpHandler(ErrorJsonHandler.ProcessRequest));

            case "rss":
                return(new DelegatingHttpHandler(ErrorRssHandler.ProcessRequest));

            case "digestrss":
                return(new DelegatingHttpHandler(ErrorDigestRssHandler.ProcessRequest));

            case "download":
                    #if NET_3_5 || NET_4_0
                return(new HttpAsyncHandler((context, getAsyncCallback) => HttpTextAsyncHandler.Create(ErrorLogDownloadHandler.ProcessRequest)(context, getAsyncCallback)));
                    #else
                return(new DelegatingHttpTaskAsyncHandler(ErrorLogDownloadHandler.ProcessRequestAsync));
                    #endif
            case "stylesheet":
                return(new DelegatingHttpHandler(ManifestResourceHandler.Create(StyleSheetHelper.StyleSheetResourceNames, "text/css", Encoding.GetEncoding("Windows-1252"), true)));

            case "test":
                throw new TestException();

            case "about":
                return(CreateTemplateHandler <AboutPage>());

            default:
                return(name.Length == 0 ? CreateTemplateHandler <ErrorLogPage>() : null);
            }
        }
        /// <summary>
        /// Returns an object that implements the <see cref="IHttpHandler"/>
        /// interface and which is responsible for serving the request.
        /// </summary>
        /// <returns>
        /// A new <see cref="IHttpHandler"/> object that processes the request.
        /// </returns>

        public virtual IHttpHandler GetHandler(HttpContextBase context, string requestType, string url, string pathTranslated)
        {
            //
            // The request resource is determined by the looking up the
            // value of the PATH_INFO server variable.
            //

            var request  = context.Request;
            var resource = request.PathInfo.Length == 0
                         ? string.Empty
                         : request.PathInfo.Substring(1).ToLowerInvariant();

            var handler = FindHandler(resource);

            if (handler == null)
            {
                throw new HttpException(404, "Resource not found.");
            }

            //
            // Check if authorized then grant or deny request.
            //

            var authorized = IsAuthorized(context);

            if (authorized == false ||
                (authorized == null && // Compatibility case...
                 !request.IsLocal &&
                 !SecurityConfiguration.Default.AllowRemoteAccess))
            {
                ManifestResourceHandler.Create("RemoteAccessError.htm", "text/html")(context);
                var response = context.Response;
                response.Status = "403 Forbidden";
                response.End();

                //
                // HttpResponse.End docs say that it throws
                // ThreadAbortException and so should never end up here but
                // that's not been the observation in the debugger. So as a
                // precautionary measure, bail out anyway.
                //

                return(null);
            }

            return(handler);
        }