IE cannot download files over SSL served by WebSphere

后端 未结 6 1721
眼角桃花
眼角桃花 2021-02-15 18:22

IE 7 & 8 both throw an error when users attempt to download a csv file over https.

Internet Explorer cannot download downloadPage.jsf. Internet Explor

相关标签:
6条回答
  • 2021-02-15 18:32

    I think you are on the right track with caching:

    This knowledge base article may help you, Internet Explorer is unable to open Office documents from an SSL Web site

    Mentioned in this Stack Overflow question: Cannot open xls file in IE

    0 讨论(0)
  • 2021-02-15 18:42

    I had the same issue with IE8. I made small changes to my code.

    Response.ClearHeaders(); //needed, otherwise "no-cache: set-cookie" was there, had to get rid of it

    Response.addHeader("Cache-Control", "private");

    0 讨论(0)
  • 2021-02-15 18:44

    I hade the same problem. After set "Content-Disposition" and "Content-Type", add this code.

    Java code

    // IE requires these three lines, exactly like this
    response.setHeader("CookiesConfigureNoCache", "false");             
    response.setHeader("Pragma","private,no-cache");     
    response.setHeader("Cache-control","private,no-store,no-cache,max-age=0,must-revalidate");
    

    PHP code

    // IE requires these three lines, exactly like this
    header("CookiesConfigureNoCache: false");
    header("Pragma: private,no-cache");
    header("Cache-control: private,no-store,no-cache,max-age=0,must-revalidate");
    
    0 讨论(0)
  • 2021-02-15 18:47

    Here's what I've done in my PHP code:

    header( "HTTP/1.0 200 OK" );
    header( "Content-Disposition: inline; filename=$path" );
    header( "Content-Type: attachment; application/pdf" );
    header( "Content-Length: $info[7]" );
    header( "Cache-Control: no-store, no-cache" );          // IE 8 requires these two lines, exactly like this
    header( "Pragma: private" );                            // IE 8 requires these two lines, exactly like this
    readfile( $tmpfile );
    
    0 讨论(0)
  • 2021-02-15 18:51

    It appears that WebSphere automatically adds Cache-Control:no-cache=set-cookie response header when cookies are included in the response. IE8 & older do not like this when downloading over SSL.

    There are two possible fixes as per this IBM Developerworks forum thread:

    1. Add the custom response header CookiesConfigureNoCache:false for HTTP transport Channel in WebSphere (it's true by default).

      response.setHeader("CookiesConfigureNoCache", "false");             
      
    2. Explicitly set the Cache-Control header after cookies are being added, this will override the WebSphere-set one.

      response.addCookie(...);
      response.addCookie(...);
      ...
      response.setHeader("Cache-Control", ...);
      
    0 讨论(0)
  • 2021-02-15 18:51

    Had the exact same issue when the app server was configured to use SSL. The trick for me to get it working after the https was turned on:

       string attachment = "attachment; filename=" + rptName + ".xls" + "";    
    
        HttpContext.Current.Response.Clear();
        HttpContext.Current.Response.ClearHeaders();
        HttpContext.Current.Response.AddHeader("content-disposition", attachment);
        HttpContext.Current.Response.AddHeader("Cache-Control", "private, max-age=1");
    
        HttpContext.Current.Response.ContentType = "application/vnd.ms-excel";
    
        HttpContext.Current.Response.Charset = "";
        HttpContext.Current.Response.Buffer = true;
        HttpContext.Current.Response.Cache.SetExpires(DateTime.Now.AddMinutes(1));
    
    0 讨论(0)
提交回复
热议问题