Note that there are some explanatory texts on larger screens.

plurals
  1. POFile download dialog IE7 disappears
    text
    copied!<p>The following code will not run correctly in IE7 with the latest service packs installed.</p> <pre><code>System.Web.HttpResponse response = System.Web.HttpContext.Current.Response; response.Clear(); response.AddHeader("Content-Disposition", "attachment;filename=Contacts.xls"); response.ContentType = "application/octet-stream"; System.Text.UnicodeEncoding Encoding = new System.Text.UnicodeEncoding(); byte[] unicodeBytes = {255,254}; int length = 2 + Encoding.GetByteCount(_exportContent); // _exportContent is string. response.AddHeader("Content-Length", length.ToString()); response.OutputStream.Write(unicodeBytes, 0, 2); unicodeBytes = Encoding.GetBytes(_exportContent); response.OutputStream.Write(unicodeBytes, 2, unicodeBytes.Length); response.End(); </code></pre> <p>I am opening the aspx page with js (window.open()) and execute the above code in the Page_Load().</p> <p>The strange thing is that the window pops up, tries to load/show the file dialog and then you hear the sound like a popup window has been blocked (although popup blocker is deactivated!).</p> <p>Extra information:<br> - The behavior happens both on XP and W2k3 (which is a real web server without anything else installed but IE7 &amp; FW 3.5 SP1 &amp; latest service packs.) - The same code works fine with FW 2.0 - Firefox has no problems to display a file dialog.</p> <p>I would be curious if anyone else has ran into the same problem and could provide a solution for getting the thing working in IE7.</p> <p>Cheers,<br> Dimi</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload