Open file in C#
<p>In my Aspx page I have two buttons, btnGenerateReceipt is for generating receipt and btnAddNew for adding new receord. OnClick event of btnGenerateReceipt I am generating and opening a receipt as below.</p>

<pre><code> protected void onGenerateReceipt(object sender, EventArgs e)
    {
          try
            {
                    byte[] document = receiptByte;
                    Response.ClearContent();
                    Response.ClearHeaders();
                    Response.Buffer = true;
                    Response.ContentType = "application/vnd.ms-word";
                    Response.AddHeader("content-disposition", "inline;filename=" + "Receipt" + ".doc");
                    Response.Charset = "";
                    Response.Cache.SetCacheability(HttpCacheability.NoCache);
                    Response.BinaryWrite(document);
                    //Response.Flush();
                }

            }
            catch (Exception ex)
            {

            }
            finally
            {
                //Response.End();
            }
        }
    }
</code></pre>

<p>This opens Open/Save/Cancel dialog box, followings are my problems,</p>

<ol>
<li>I need the word document to open automatically without the dialog box.</li>
<li>My second button's click function doesn't fire after I click btnGenerateReceipt button.</li>
<li>How can I generate&amp;Open PDF file instead of word Doc?</li>
</ol>

<p>Any idea?</p>
