Created
February 27, 2014 15:31
-
-
Save weslley39/9252363 to your computer and use it in GitHub Desktop.
Forcing download of a type in Asp Mvc C#
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var bytes = Encoding.UTF8.GetBytes(sb.ToString()); | |
Stream stream = new MemoryStream(bytes); | |
stream.Flush(); | |
stream.Position = 0; | |
Response.ContentType = "text/plain"; | |
Response.AppendHeader("content-disposition", "attachment;filename=exportacao"); | |
return new FileStreamResult(stream, "text/plain"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment