ASP Export to Excel Client side and have browser knwo what application it is
<p>I'm using the below code and I'm specifying what type of application it is.  However, when prompted to open the application the browser does not know what type of file it is.  How can I make the browser already want to open it as an excel?</p>

<p>Any help is appreciated</p>

<pre><code>public static void ExportToSpreadsheet(DataTable table, string name)
{
    HttpContext context = HttpContext.Current;
    context.Response.Clear();
    foreach (DataColumn column in table.Columns)
    {
        context.Response.Write(column.ColumnName + "\t");
    }
    context.Response.Write(Environment.NewLine);
    foreach (DataRow row in table.Rows)
    {
        for (int i = 0; i &lt; table.Columns.Count; i++)
        {
            context.Response.Write(row[i].ToString() + "\t");
        }
        context.Response.Write(Environment.NewLine);
    }
    context.Response.ContentType = "application/ms-excel";
    context.Response.AppendHeader("Content-Disposition", "attachment; filename=" + name+ ".xls");
    context.Response.End();
}
</code></pre>
