android - 在 Coldfusion 中使用 cfheader 和 cfcontent 时在移动浏览器(Android)上下载不成功

标签 android iis mobile coldfusion httpresponse

当我从桌面浏览器运行下面的代码时,没有问题。

但是,当我从 Android Chrome 或默认的 Android 浏览器尝试时,我总是收到“下载不成功”的消息。

代码:

<cfsetting enablecfoutputonly="yes">

<cfcontent type="text/calendar" reset="Yes">
<cfheader name="Content-Disposition" value='inline; filename="newAppointment.ics"'>

<cfoutput>BEGIN:VCALENDAR
PRODID:-//Some organization//some application//EN
VERSION:2.0
METHOD:REQUEST
BEGIN:VEVENT
UID:20120925T072912Z-140@http://localhost/www/
CREATED:20140925T072912Z
DTSTAMP:20140922T090500Z
DTSTART:20140922T090500Z
DTEND:20140922T100500Z
DESCRIPTION:Please attend this sample meeting
SUMMARY:Invitation to attend training
LOCATION:Earth
ATTENDEE;RSVP=TRUE:mailto:periklis@example.com
ORGANIZER;CN=periklis@example.com:mailto:periklis@example.com
LAST-MODIFIED:20140925T072912Z
PRIORITY:5
SEQUENCE:0
STATUS:CONFIRMED
TRANSP:TRANSPARENT
END:VEVENT
END:VCALENDAR</cfoutput>

<cfsetting enablecfoutputonly="no">

我尝试过同时使用“text/calendar”和“application/octet-stream”作为内容类型,同时使用“inline”和“attachment”作为内容配置。我也试过带引号和不带引号的文件名……都无济于事。

我们在 IIS 服务器上运行 Coldfusion 10,我们将此配置添加到服务器,以便我们现在可以直接从服务器下载 .ics 文件。但是,我们希望动态生成一次性文件并将其提供给用户。

IIS 服务器设置:

<configuration>
    <system.webServer>
        <staticContent>
            <remove fileExtension=".ics" />
            <mimeMap fileExtension=".ics" mimeType="application/octet-stream" />
        </staticContent>
    </system.webServer>
</configuration>

使用 Chrome 的远程调试,我可以看到这是来自上面代码的响应 header 。 (注意:我看到很多人先放 cfheader,然后放 cfcontent...但是如果我按照这个顺序,内容处置不会传递,所以我一直把 cfcontent 放在第一位。)

响应头:

HTTP/1.1 200 OK
Connection: close
Date: Fri, 05 Sep 2014 21:31:31 GMT
Server: Microsoft-IIS/6.0
P3P: CP='NOI DSP COR LAW NID CUR ADMa OUR DELa IND PHY ONL UNI PUR COM NAV STA'
Vary: Accept-Encoding,User-Agent
Content-Disposition: inline; filename="newAppointment.ics"
Content-Type: text/calendar;charset=UTF-8

我在互联网上搜索过,我发现的最接近的东西是另一个 stackoverflow 问题,有一些建议但没有被接受的答案。另外...作为新用户,我无法评论它以询问是否找到答案。

cfheader cfcontent Mobile Browser download unsuccessful

我尽可能多地提供我能想到的细节。让我知道更多信息是否有助于解决这个问题。

一如既往,我们将不胜感激。

最佳答案

尝试将其从“内联”更改为“附件”

<cfheader name="Content-Disposition" value='inline; filename="newAppointment.ics"'>

<cfheader name="Content-Disposition" value="attachment; filename=""newAppointment.ics""">

关于android - 在 Coldfusion 中使用 cfheader 和 cfcontent 时在移动浏览器(Android)上下载不成功,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25694654/

相关文章:

安卓应用背景: using multiple images

java - Android BottomNavigation和Tabs,第一次点击后 View 消失

android - 无法从 aar 访问类

windows - WCF 异常 : . ..此服务需要 'Anonymous' 身份验证,但未为托管此服务的 IIS 应用程序启用

php - 在 IIS7.5 下无法用 PHP 显示错误

windows - RDWeb 错误 403 通过选择默认站点的其他物理路径

javascript - 在 jQuery Mobile 的数据角色 ="header"上禁用页面转换

android - 如何配置 Trigger.IO 以将 Intel Atom x86 目标用于我的 Android 虚拟设备?

java - 使用 @UiThreadTest 注解查看测试 setUp() 方法中的异常

google-chrome - Chrome "Emulate Touch Events"无法正常工作