2013-10-01 88 views
1

我試圖從客戶端計算機(IE8)上從我的Intranet站點下載Excel文件,並且出現以下錯誤 - 無法下載。 無法打開此網站。請求的網站ID無法使用或無法找到。請稍後再試。仍然收到錯誤 - 無法下載。無法打開此網站

一個我已經找到解決這個問題的最好的鏈接的是 - IE : Unable to download * from *. Unable to open this Internet site. The requested site is either unavailable or cannot be found

我已經累得幾乎這裏的一切,尤其是圓形是我的代碼snippent

protected void Page_PreInit(object sender, EventArgs e) 
{ 
    HttpContext.Current.Response.ClearHeaders(); 

    switch (Users.Current.UserId) 
    { 
     case 17: 
     case 73: 
      HttpContext.Current.Response.AddHeader("Cache-Control", "no-cache"); 
      break; 
     case 80: 
      HttpContext.Current.Response.AddHeader("Cache-Control", "private"); 
      HttpContext.Current.Response.AddHeader("Pragma", "token"); 
      break; 
     case 76: 
      HttpContext.Current.Response.AddHeader("Cache-Control", "private"); 
      break; 
     case 88: 
      HttpContext.Current.Response.AddHeader("Cache-Control", "no-store"); 
      HttpContext.Current.Response.AddHeader("Pragma", "token"); 
      break; 
     default: 
      HttpContext.Current.Response.AddHeader("Pragma", "no-cache"); 
      break; 
     } 
} 

無組合似乎工作。 在定義標題後是否需要添加任何內容?

P.S.我不能亂註冊表或在客戶機上切換瀏覽器。

+0

它在你使用瀏覽器時有效,對吧?如果是這樣,請使用Fiddler並確保您的請求是相同的。 –

+0

它適用於具有IE 9的非客戶端計算機。驗證兩臺計算機上的請求是否相同。 –

回答

0

HttpContext.Current.Response.AddHeader(「Pragma」,「token」);

- 將此代碼添加到代碼解決了我的問題。

相關問題