title: Create text file and download without saving on server in ASP.net Core MVC 2.1
body: <p>I've found a way to create a text file then instantly download it in the browser without writing it to the server in regular ASP.net:</p>
  
  <p><a href="https://stackoverflow.com/questions/4570433/create-text-file-and-download">Create text file and download</a></p>
  
  <p>The accepted answer uses:</p>
  
  <pre><code>using (StreamWriter writer = new StreamWriter(Response.OutputStream, Encoding.UTF8)) {
    writer.Write("This is the content");
  }
  </code></pre>
  
  <p>I need to do this in ASP.net Core 2.1 MVC - though in that doesn't know what Response.OutputStream is - and I can't find anything on Google to help with that, or other ways to do this.</p>
  
  <p>How can I do this? Thanks.</p>