In WebForms, I would normally have code like this to download a PDF:
Response.Clear()
Response.ClearHeaders()
'//Send the file to the output stream
Response.Buffer = True
Response.AddHeader("Content-Length", pdfData.Length.ToString())
Response.AddHeader("Content-Disposition", "attachment; filename= " & Server.HtmlEncode(filename))
'//Set the output stream to the correct content type (PDF).
Response.ContentType = "application/pdf"
'//Output the file
Response.BinaryWrite(pdfData)
'//Flushing the Response to display the serialized data
'//to the client browser.
Response.Flush()
Response.End()
How do I accomplish the same task in ASP.NET MVC?