asp .net core静态文件资源的深入讲解
app.UseStaticFiles(new StaticFileOptions { FileProvider = new PhysicalFileProvider(Path.Combine(env.ContentRootPath, "Static")), RequestPath = "/static", OnPrepareResponse = ctx => { ctx.Context.Response.Headers.Append("cache-control", $"public,max-age={cacheMaxAge}"); }, ServeUnknownFileTypes = true, DefaultContentType = "image/png" } ); ServeUnknownFileTypes true DefaultContentType "image/png" 让客户端按照图片处理。 但是官方给了建议。 启用 ServeUnknownFileTypes 会形成安全隐患。 它默认处于禁用状态,不建议使用。 FileExtensionContentTypeProvider 提供了更安全的替代方法来提供含非标准扩展名的文件。 (编辑:濮阳站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- 宅经济下的家居业进击:京东11.11供应链能力助推场景化家居
- iPhone X网络支持 iPhone 10网络支持 iPhone X型号 iPhone
- Novus轻量级电动摩托车 它更像是艺术品
- ios11.1 beta2更新了什么 ios11.1 beta2更新内容一览
- 原研哉做客少海汇,解读無印良品首次在中国落地家装背后的故
- 异步 HttpContext.Current实现取值的方法(解决异步Applicat
- 2020年智能家居设备出货量将达到8.54亿台
- 第一次去红木家具工厂看什么?九典红木告诉你!
- ASP技术在论坛中的运用(四)
- iOS 11.1 Beta2怎么更新 iOS 11.1 Beta2怎么升级