title: Show Response.Binarywrite in browser save dialog or open new window and close after save
body: <p>My problem looks like this.
  I have a grid with documents (Id's). Now when somebody clicks at a row I would like to allow him to download or show that document. But to make it esier let's say that I would do this on a button click. I tried two approaches but none of them worked form me.</p>
  
  <ol>
  <li><p>I tried to response.binarywrite on the button click:</p>
  
  <pre><code>        Response.Clear();
          Response.ClearHeaders();
          Response.ClearContent();
          Response.ContentType = "application/postscript mime";
          Response.AddHeader("content-disposition", "attachment; filename=test.ps"); 
          Response.AddHeader("content-length", _excuteGetDocumentResult.Length.ToString());
          Response.ContentEncoding = new System.Text.UTF8Encoding();
          Response.BinaryWrite(_excuteGetDocumentResult);
  </code></pre></li>
  </ol>
  
  <p>But nothing happens and when I  try to modify this code I usually get some javascript errors saying sommething about changing the response...</p>
  
  <p>The socond approach was opening new window and on page load adding the code above.</p>
  
  <pre><code>&lt;asp:Button Text="ShowResult" OnClientClick="radopen('ShowResult.aspx','ShowDocumentDialog'); return false;"
          runat="server" /&gt;
  </code></pre>
  
  <p>The socond approach works but my opened window still exists after saving or canceling the explorer saving file dialog window. I tried to add some javascript to close it but it only works where there is no <strong>response.binarywrite</strong> on the load page...</p>
  
  <p>Any ideas how I can achive what I want? </p>