c# - Does File() In asp.net mvc close the stream? -


I think you do something like this

  public fileResult result () {stream Stream = new stream (); Return file (stream, "text / html", "bob html"); }  

If the file () will stop the stream for you? Since I tried to keep the "stream" in an experiment statement but I always had an error saying that the stream was closed. {Return stream (stream, "text / html", "bob_ html");}}

  public fileResult result () (using (stream stream = new stream) Code>   

If you are using the file object, the resulting file Bob.html then yes to download as Bob.

I believe all attempts to flush off standard streams (outputstream, file stream, cryptosystem) or when disposed off

There are several squares within the MVC framework that apply the base FileResult class.

  System.Web.Mvc.FileResult System .Web.Mvc.FileContentResult System.Web .Mvc.FilePathResult System.Web.Mvc.FileStreamResult  

Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -