title: MemoryStream to virtual file
body: <p>I have the following:</p>
  
  <pre><code>using(var memoryStream = new MemoryStream())
  {
     gc.CreatePackage(memoryStream);
  }
  </code></pre>
  
  <p>MemoryStream spits out an excel fil.  From the memoryStream, how do I go about actually showing the file that is produced. Note that I do not want to actually save the file to disk but merely display it. </p>
  
  <p>So far I have the following but doesn't seem to work:</p>
  
  <pre><code>using (var memoryStream = new MemoryStream())
  {
      gc.CreatePackage(memoryStream);
  
      using (var fileStream = File.OpenWrite("Test.xlsx"))
      {
          memoryStream.WriteTo(fileStream);
      }                
  }
  </code></pre>
  
  <p>But not sure if I am on the right direction. I get an error saying:</p>
  
  <blockquote>
    <p>System.Web.Mvc.Controller.File(byte[], string)' is a 'method', which
    is not valid in the given context</p>
  </blockquote>
  
  <p>I am not sure if I am going about this in the right direction.</p>