2011-11-15 8 views
6

enter image description hereसंसाधन अन्य के रूप में व्याख्या किया गया लेकिन एमआईएमई प्रकार के साथ स्थानांतरित किया गया अपरिभाषित। IE के लिए त्रुटि (Asp.net वेबसाइट)

जब मैं Chrome से ठीक काम करता है डाउनलोड करने के लिए प्रयास करते हैं, लेकिन आईई 8 में इसे डाउनलोड करने नहीं है यह उपरोक्त त्रुटि दिखा रहा है,

protected void btn_ExcelDownload_Click(object sender, EventArgs e) 
{ 
    Grid_UserTable.Columns[0].Visible = false; 
    string subject = lbl_Subj.Text; 
    Response.Buffer = true; 
    Response.Clear(); 
    Response.ClearHeaders(); 
    Response.AddHeader("Cache-Control", "no-store, no-cache"); 
    Response.AddHeader("content-disposition", "attachment;filename=" + subject + "-Status.xls"); 
    Response.Charset = ""; 
    Response.Cache.SetCacheability(HttpCacheability.NoCache); 
    Response.ContentType = "application/vnd.ms-excel"; 
    System.IO.StringWriter stringWrite = new System.IO.StringWriter(); 
    System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite); 
    Grid_UserTable.RenderControl(htmlWrite); 
    rptList.RenderControl(htmlWrite); 
    Response.Write(stringWrite.ToString());  
    Response.End(); 
} 

जब मैंने क्रोम में डेवलपर टूल का उपयोग किया, इसे रिसोर्स को अन्य के रूप में व्याख्या किया गया लेकिन एमआईएमई प्रकार के साथ अपरिभाषित किया गया। त्रुटि लेकिन फ़ाइल डाउनलोड की गई, लेकिन आईई छवि में दिखाए गए त्रुटि को फेंक रहा है, मुझे क्या करना चाहिए, धन्यवाद।

जब मैं विजुअल स्टूडियो का उपयोग कर वेबसाइट चलाता हूं, तो मैं IE8 में फ़ाइल डाउनलोड करने में सक्षम हूं, लेकिन जब मैं सर्वर में अपलोड की गई वेबसाइट से इसे डाउनलोड करने का प्रयास करता हूं तो मुझे उपरोक्त त्रुटि मिल रही है, त्रुटि केवल आईई 8.

मैंने आईई ब्राउज़र संगतता मोड को चालू और बंद करने की कोशिश की, फिर भी मुझे एक ही त्रुटि मिलती है।

यह यह काम हो सकता है मेरे सिर सामग्री

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="Server"> 
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" /> 
+0

मैंने आपके कोड का परीक्षण किया और यह आईई 8 में मेरे लिए काम किया। IE का कौन सा संस्करण आप उपयोग कर रहे हैं? – NaveenBhat

+0

यह स्थानीय होस्ट में काम करता है, जब सर्वर में अपलोड किया जाता है तो यह उपर्युक्त त्रुटि देता है। – John

+0

http://stackoverflow.com/questions/2133776/ie8-wont-download-a-file-with-a-custom-mime-type-with-uac- समान समस्या – John

उत्तर

3
Response.Cache.SetCacheability(HttpCacheability.NoCache); 

कोड से इस लाइन को हटाने के द्वारा हल।

2

है:

Response.ClearHeaders(); 
Response.AddHeader("Cache-Control", "no-store, no-cache"); 

Source link

+0

मुझे एक ही त्रुटि मिल रही है – John

+0

द्वारा आजमाएं बफर 'Response.Buffer = true को सक्षम करना;' इसके अलावा, 'application/vnd.ms-excel' आज़माएं – NaveenBhat

संबंधित मुद्दे

 संबंधित मुद्दे