ASP.NET 5 can't use Response
<p>I'm trying to output information from my database to an Excel File using ASP.Net 5. In my controller I have two methods for this.</p>

<pre><code>public void ExportData()
    {
        var data = new[]{
                           new{ Name="Ram", Email="ram@techbrij.com", Phone="111-222-3333" },
                           new{ Name="Shyam", Email="shyam@techbrij.com", Phone="159-222-1596" },
                           new{ Name="Mohan", Email="mohan@techbrij.com", Phone="456-222-4569" },
                           new{ Name="Sohan", Email="sohan@techbrij.com", Phone="789-456-3333" },
                           new{ Name="Karan", Email="karan@techbrij.com", Phone="111-222-1234" },
                           new{ Name="Brij", Email="brij@techbrij.com", Phone="111-222-3333" }
                  };

        System.Web.HttpContext.Current.Response.ClearContent();
        System.Web.HttpContext.Current.Response.AddHeader("content-disposition", "attachment;filename=Contact.xls");
        System.Web.HttpContext.Current.Response.AddHeader("Content-Type", "application/vnd.ms-excel");
        WriteTsv(data, System.Web.HttpContext.Current.Response.Output);
        System.Web.HttpContext.Current.Response.End();
    }


public void WriteTsv&lt;T&gt;(IEnumerable&lt;T&gt; data, TextWriter output)
    {
        PropertyDescriptorCollection props = TypeDescriptor.GetProperties(typeof(T));
        foreach (PropertyDescriptor prop in props)
        {
            output.Write(prop.DisplayName); // header
            output.Write("\t");
        }
        output.WriteLine();
        foreach (T item in data)
        {
            foreach (PropertyDescriptor prop in props)
            {
                output.Write(prop.Converter.ConvertToString(
                     prop.GetValue(item)));
                output.Write("\t");
            }
            output.WriteLine();
        }
    }
</code></pre>

<p>I am forced to use <strong>System.Web</strong> because I have no idea how to export an excel file using ASP.Net 5, thus I'm currently using <strong>dnx451</strong>. I deleted <strong>dnxcore50</strong> from my project.json in order to use System.Web.</p>

<p>However when calling the top method, I get the following error:</p>

<pre><code>NullReferenceException: Object reference not set to an instance of an object.
</code></pre>

<p>on</p>

<pre><code>System.Web.HttpContext.Current.Response.ClearContent();
</code></pre>

<p>The original example of this code used:</p>

<pre><code>Response
</code></pre>

<p>Instead of:</p>

<pre><code>System.Web.HttpContext.Current.Response
</code></pre>

<p>I cannot use just use <strong>Response</strong> because it uses Microsoft.AspNet.Http.HttpResponse instead of System.Web</p>

<p>Using System.Web.HttpResponse also doesn't work because it gives the following error:</p>

<pre><code>An object reference is required for the non-static field, method, or property
</code></pre>

<p>This is my first web application and this problem has caused me to grind into a halt. Can anyone help me?</p>