R – A custom ActionResult for a multi-part http response

actionresultasp.net-mvchttphttpresponsemultipart

I'd like to respond to an http request with both a txt file and an html page. This way the client can save the file and see a summary of that file's contents via an html page.

Since the file is generated on the fly, I have to use state management on the server to generate the summary on the second request. I'd like to avoid this and wrap this up in a single response.

What would the custom ActionResult look like?

Best Answer

This was also discussed here on SO.

i answered it like this:

Nope, multipart attachments for download (like as in email) aren't supported for security reasons. It's called a "drive-by download."

Note that Gmail handles this by dynamically zipping up the files. You should too. http://forums.asp.net/t/1240811.aspx

I don't believe any modern browser supports multipart/mixed.