StaticFileOptions Class¶
Options for serving static files
- Namespace
Microsoft.AspNetCore.Builder
- Assemblies
- Microsoft.AspNetCore.StaticFiles
Syntax¶
public class StaticFileOptions : SharedOptionsBase
-
class
Microsoft.AspNetCore.Builder.
StaticFileOptions
Constructors¶
-
StaticFileOptions
()¶ Defaults to all request paths
public StaticFileOptions()
-
StaticFileOptions
(Microsoft.AspNetCore.StaticFiles.Infrastructure.SharedOptions) Defaults to all request paths
public StaticFileOptions(SharedOptions sharedOptions)
-
Properties¶
-
Microsoft.AspNetCore.Builder.StaticFileOptions.
ContentTypeProvider
¶ Used to map files to content-types.
Return type: Microsoft.AspNetCore.StaticFiles.IContentTypeProvider public IContentTypeProvider ContentTypeProvider { get; set; }
-
Microsoft.AspNetCore.Builder.StaticFileOptions.
DefaultContentType
¶ 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
Return type: System.String public string DefaultContentType { get; set; }
-
Microsoft.AspNetCore.Builder.StaticFileOptions.
OnPrepareResponse
¶ 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.
Return type: System.Action<Microsoft.AspNetCore.StaticFiles.StaticFileResponseContext> public Action<StaticFileResponseContext> OnPrepareResponse { get; set; }
-
Microsoft.AspNetCore.Builder.StaticFileOptions.
ServeUnknownFileTypes
¶ If the file is not a recognized content-type should it be served? Default: false.
Return type: System.Boolean public bool ServeUnknownFileTypes { get; set; }
-