// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using Microsoft.AspNet.StaticFiles.Infrastructure; namespace Microsoft.AspNet.StaticFiles { /// /// Options for serving static files /// public class StaticFileOptions : SharedOptionsBase { /// /// Defaults to all request paths in the current physical directory /// public StaticFileOptions() : this(new SharedOptions()) { } /// /// Defaults to all request paths in the current physical directory /// /// public StaticFileOptions(SharedOptions sharedOptions) : base(sharedOptions) { ContentTypeProvider = new FileExtensionContentTypeProvider(); OnPrepareResponse = _ => { }; } /// /// Used to map files to content-types. /// public IContentTypeProvider ContentTypeProvider { get; set; } /// /// The default content type for a request if the ContentTypeProvider cannot determine one. /// None is provided by default, so the client must determine the format themselves. /// http://www.w3.org/Protocols/rfc2616/rfc2616-sec7.html#sec7 /// public string DefaultContentType { get; set; } /// /// If the file is not a recognized content-type should it be served? /// Default: false. /// public bool ServeUnknownFileTypes { get; set; } /// /// Called after the status code and headers have been set, but before the body has been written. /// This can be used to add or change the response headers. /// public Action OnPrepareResponse { get; set; } } }