Response.BinaryWrite calls the ASPX page twice

Posted by Jon.ee on Stack Overflow See other posts from Stack Overflow or by Jon.ee
Published on 2012-08-07T20:28:43Z Indexed on 2012/10/17 11:01 UTC
Read the original article Hit count: 169

Filed under:
|

I am trying to open a file in the browser using BinaryWriter. This causes the a dialog window to open and prompt the user to save or open the file. That behavior is fine; however, if I select open, the aspx page is called again and after a long wait the file finally opens.

I set the ContentType

Response.BinaryWrite(binary);
Response.End();
Repsonse.Close();

This behavior only occurs with excel and word files.

Browser IE8

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET