Windows XP Windows 7 Windows 2003 Windows Vista Windows教程綜合 Linux 系統教程
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟件教程
 Windows教程網 >> 電腦軟件教程 >> 服務器技術 >> 關於服務器 >> IIS啟用Gzip壓縮造成OpenFlashChart不能正常顯示問題及解決方法

IIS啟用Gzip壓縮造成OpenFlashChart不能正常顯示問題及解決方法

日期:2017/2/8 10:21:26      編輯:關於服務器

      在.NET中使用OpenFlashChart控件顯示圖表時,誰會想到圖表顯示正常與否竟然和服務器IIS是否啟用了Gzip壓縮有關呢?

       兩個站點用著同一套程序,一個站點OpenFlashChart圖表能正常顯示,另一個站點卻顯示為“ioerror Error #2032”,而且這個問題只出現在IE6浏覽器中,火狐和IE7中都能正常顯示,是什麼原因造成的呢?
 

    在網絡上搜索了下,才查到原因是服務器上采用了Gzip壓縮優化網站和no-cache同時出現造成的,解決方法是在返回的頁面裡增加HTTP頭,示例代碼如下:

      Response.Clear();
      //Response.CacheControl = "no-cache";
      //用這句代替上面一句
      Response.AppendHeader("Cache-Control", "no-cache, no-store, must-revalidate, max-age=-1");
      Response.Write(chart.ToString()); //輸出openflashchat流
      Response.End();

      修改之後,在IE6下OpenFlashChart圖表終於正常顯示出來了。

Copyright © Windows教程網 All Rights Reserved