Пример #1
0
        /// <summary>
        /// Creates a new instance of the SendFileMiddleware.
        /// </summary>
        /// <param name="next">The next middleware in the pipeline.</param>
        /// <param name="options">The configuration for this middleware.</param>
        public DirectoryBrowserMiddleware(RequestDelegate next, IHostingEnvironment hostingEnv, DirectoryBrowserOptions options)
        {
            if (next == null)
            {
                throw new ArgumentNullException(nameof(next));
            }

            if (hostingEnv == null)
            {
                throw new ArgumentNullException(nameof(hostingEnv));
            }

            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            if (options.Formatter == null)
            {
                throw new ArgumentException(Resources.Args_NoFormatter);
            }
            options.ResolveFileProvider(hostingEnv);

            _next     = next;
            _options  = options;
            _matchUrl = options.RequestPath;
        }
Пример #2
0
 /// <summary>
 /// Creates a combined options class for all of the static file middleware components.
 /// </summary>
 public FileServerOptions()
     : base(new SharedOptions())
 {
     StaticFileOptions       = new StaticFileOptions(SharedOptions);
     DirectoryBrowserOptions = new DirectoryBrowserOptions(SharedOptions);
     DefaultFilesOptions     = new DefaultFilesOptions(SharedOptions);
     EnableDefaultFiles      = true;
 }