Skip to main content
Participant
June 26, 2009
Question

Cfcontent type excel over SSL

  • June 26, 2009
  • 1 reply
  • 1777 views

Hi guys, I dump an excel file using

<cfcontent type="application/msexcel">
<cfheader name="content-disposition" value="attachment;filename=term.xls">

and works fine in dev (http), but once I go to production (https) Internet Explorer won't open it. I remove those headers and IE shows the html table just fine, but when I add back the excel header I get the error "Internet Explorer was not able to open the internet site. The requested site is either unavailable or cannot be found". It also works fine in Firefox.

Any work around for this?

thanks!

    This topic has been closed for replies.

    1 reply

    June 26, 2009

    My guess is that you have a Cache-Control header set that prevents it from saving the file in IE.  Try these cache-control settings:

    <!--- set standard header fields to prevent caching but allow streamed download of exported files --->

    <cfheader name="Cache-Control" value="private, must-revalidate, max-age=0"/>
            <cfheader name="Expires" value="Mon, 06 Jan 1990 00:00:01 GMT"/>

    The other possibility is that your IE has the Tools --> Advanced --> Security --> Do not save encrypted pages to disk setting checked.  You NEED to uncheck this.

    Participant
    June 26, 2009

    Thanks for your reply. The IE option is unchecked.

    I created a new folder with an empty application.cfm and a test.cfm file with:

    <cfheader name="Cache-Control" value="private, must-revalidate, max-age=0"/>
    <cfheader name="Expires" value="Mon, 06 Jan 1990 00:00:01 GMT"/>
    <cfheader name="Content-Disposition" value="inline; filename=theFile.xls">
    <cfcontent type="application/vnd.ms-excel">
    Test<cfabort>

    and IE asks me to save test.cfm [Edit: actually asks me if I want to save test_cfm   it automatically changes the . for the _ !!! :S] and when I click ok it gives me the "Cannot access the file" error.

    Ugh. This sucks.

    jd.

    June 26, 2009

    Depending on where you use <cfheader> it might be ignored (especially if you've ever flushed the page).


    Try this first:

    <cfcontent type="text/xml" reset="true" variable="#reportContent.content#"/>

    if you're on a high even CF where you can set a variable in cfcontent.

    See: http://support.microsoft.com/kb/323308 for more information on your problem on general.

    And if you haven't, try downloading Fiddler (http://www.fiddler2.com/fiddler2/) to verify what your cache-control settings you are sending back to IE on this page.  You don't want to be sending either no-cache or no-store to the client.

    Hope this helps!