Export to Excel in ASP.Net Core 2.0 : <p>I used to export data to excel in asp.net mvc using below code </p>

<pre><code>    Response.AppendHeader("content-disposition", "attachment;filename=ExportedHtml.xls");
    Response.Charset = "";
    Response.Cache.SetCacheability(HttpCacheability.NoCache);
    Response.ContentType = "application/vnd.ms-excel";
    this.EnableViewState = false;
    Response.Write(ExportDiv.InnerHtml);
    Response.End();
</code></pre>

<p>When this Code Run it create a file and ask for a location to save </p>

<p>I tried working with NPOI and create Excel file very well but cant save file on client location .</p>

<p>Is there any way to make above code works on asp.net core 2.0 or any other way where I can save data in excel format on client machine ?</p>
