Content-Disposition:What are the differences between quot;inlinequot; and quot;attachmentquot;?(Content-Disposition:“inline和“inline有什么区别?和“附件?)
问题描述
两者有什么区别
Response.AddHeader("Content-Disposition", "attachment;filename=somefile.ext")
和
Response.AddHeader("Content-Disposition", "inline;filename=somefile.ext")
我不知道它们的区别,因为当我使用一个或另一个时,我总是会收到一个窗口提示,要求我下载它们的文件.我读了规格,但它一无所知.
I don't know the differences , because when I use one or another I always get a window prompt asking me to download the file for both of them. I read the specs, but it is clueless.
推荐答案
因为当我使用一个或另一个时,我得到一个窗口提示,要求我下载他们两个的文件.
Because when I use one or another I get a window prompt asking me to download the file for both of them.
此行为取决于浏览器和您尝试提供的文件.使用内联,浏览器会尝试在浏览器中打开文件.
This behavior depends on the browser and the file you are trying to serve. With inline, the browser will try to open the file within the browser.
例如,如果您有一个 PDF 文件和 Firefox/Adobe Reader,内联处置将在 Firefox 中打开 PDF,而附件将强制下载.
For example, if you have a PDF file and Firefox/Adobe Reader, an inline disposition will open the PDF within Firefox, whereas attachment will force it to download.
如果您提供 .ZIP 文件,浏览器将无法以内联方式显示它,因此对于内联和附件配置,将下载该文件.
If you're serving a .ZIP file, browsers won't be able to display it inline, so for inline and attachment dispositions, the file will be downloaded.
这篇关于Content-Disposition:“inline"和“inline"有什么区别?和“附件"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Content-Disposition:“inline"和“inline"有什么区别?和“附件"?


- 如何用自己压缩一个 IEnumerable 2022-01-01
- C# 中多线程网络服务器的模式 2022-01-01
- 良好实践:如何重用 .csproj 和 .sln 文件来为 CI 创建 2022-01-01
- 在哪里可以找到使用中的C#/XML文档注释的好例子? 2022-01-01
- MoreLinq maxBy vs LINQ max + where 2022-01-01
- Web Api 中的 Swagger .netcore 3.1,使用 swagger UI 设置日期时间格式 2022-01-01
- WebMatrix WebSecurity PasswordSalt 2022-01-01
- C#MongoDB使用Builders查找派生对象 2022-09-04
- 输入按键事件处理程序 2022-01-01
- 带有服务/守护程序应用程序的 Microsoft Graph CSharp SDK 和 OneDrive for Business - 配额方面返回 null 2022-01-01