且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

文件下载失败过在IE HTTPS

更新时间:2023-01-05 13:50:02

由于用户 SquidScareMe 写道,你要忽略/不碰下载他们通过SSL当Office文件高速缓存设置。

As user SquidScareMe writes, you have to ignore/don't touch the cache settings for Office files when downloading them over SSL.

我有像片段的 ashx的处理程序

// "Internet Explorer is unable to open Office documents from an SSL Web site".
// http://support.microsoft.com/kb/316431/en-us
if (!context.Request.IsSecureConnection || !isInternetExplorer(context))
{
    // No cache.
    context.Response.Cache.SetCacheability(HttpCacheability.NoCache);
    context.Response.AppendHeader(@"Pragma", @"no-cache");
}

通过这个功能:

private static bool isInternetExplorer(HttpContext context)
{
    return context.Request.Browser.Browser == @"IE";
}