Skip to content

How to allow .config file download? #31973

Closed
@ahdung

Description

@ahdung

I hope all files in a specified folder can be download, so I did this:

var provider = new FileExtensionContentTypeProvider();
provider.Mappings[".config"] = "application/octet-stream";

app.UseStaticFiles(new StaticFileOptions()
{
    FileProvider          = new PhysicalFileProvider(Path.Combine(env.ContentRootPath, "xxx")),
    RequestPath           = "/xxx",
    ServeUnknownFileTypes = true,
    DefaultContentType    = "application/octet-stream",
    ContentTypeProvider   = provider,
});

it work well for .exe|.dll, except .config, got this:
image

Please help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ✔️ Resolution: AnsweredResolved because the question asked by the original author has been answered.ExternalThis is an issue in a component not contained in this repository. It is open for tracking purposes.Status: Resolved

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions