I had an issue where someone wanted to stream a file that was generated on the web server and prevent it from caching on the client.  The correct way to do this is to specify the Cache-Control: no-cache header.  When this was done however the pdf file did not display using https and on Windows XP.  After some research the method that worked for this scenario was to define an OBJECT tag and point the SRC attribute to the page that generates the file on the fly.

 Example code:

This is an example of the failing page:

<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
script runat="server">

protected void Button1_Click(object sender, EventArgs e)
{

Response.ContentType = "application/pdf";
Response.Clear();

Response.TransmitFile("leopardsupport.pdf");
Response.End();

}

</script>
    <
html xmlns="http://www.w3.org/1999/xhtml">
        <
head runat="server">
            <title>Untitled Page</title>
        </head>
    <
body>
        <form id="form1" runat="server">
            <div>
            </div>
        <asp:Button ID="Button1" runat="server" style="margin-bottom: 0px"
              Text="Button" onclick="Button1_Click" />
        </form>
    </
body>
</
html>
 

This is the solution:

The source page:

<html>
    <head>
       
<title>PDF File</title>
    </
head>

    <body>
        <
object CLASSID='clsid:CA8A9780-280D-11CF-A24D-444553540000'
            TYPE='application/pdf' style='width: 100%;
           height
:100%;position:absolute;top:0px;left:0px;
           
margin:0px;padding:0px;border:0px;right:580px;bottom:500px;'>
           
<PARAM NAME='src' VALUE='https://MYSERVER/PDFDnld/DownloadWorker.aspx'>
        </object>
    </body>
</
html>

Here is the page generating the pdf file:

<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
script runat="server">

protected void Page_Load(object sender, EventArgs e)
{

    Response.ContentType = "application/pdf";
    Response.Clear();
    Response.TransmitFile(
"temp.pdf");
    Response.End();

}

</script>

You could of course stream a pdf file generated on the fly instead of using TransmitFile.

The reason this works is because the href that is used in the object tag works around the issue per this KB article: http://support.microsoft.com/kb/323308 "Internet Explorer file downloads over SSL do not work with the cache control headers" (see workaround section).  This would apply for the no-store header as well.

Let me know if this BLOG entry helped you!