Export To Excel Without Response.End()

using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;


public partial class _Default : System.Web.UI.Page
{
   
    Table table = new Table();
    protected void Page_Load(object sender, EventArgs e)
    {
   
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        try
        {
            ExportGridView();
        }
        catch (Exception ex)
        {
        }
    }

    private void ExportGridView()
    {
        try
        {

            GridView1.AllowPaging = false;
            GridView1.DataBind();
            string attachment = "attachment; filename=Contacts.xls";
            Response.ClearContent();
            Response.AddHeader("content-disposition", attachment);
            Response.ContentType = "application/ms-excel";
            StringWriter sw = new StringWriter();
            HtmlTextWriter htw = new HtmlTextWriter(sw);
            GridView1.RenderControl(htw);
            Response.Write(sw.ToString());
            Response.Flush();
            HttpContext.Current.ApplicationInstance.CompleteRequest();
            Response.Close();
        }
        catch (Exception ex)
        {
        }
    }
    public override void VerifyRenderingInServerForm(Control control)
    {
    }
}