HTTP Headers in Asp.net to alter the transfer of files

I was tinkering around with sending files across a web site at work and found this article by particularly useful.

http://blog.tylerholmes.com/2008/05/http-headers-content-type-and-content.html

It covers the setting of the Mime Type, changing the file name that comes across and forcing it to appear as a pop up.

Changing Mime type:

context.Response.ContentType = “application/vnd.ms-powerpoint”;

Force Pop up and changing file name:

context.Response.AddHeader(“Content-Disposition”,
“attachment; filename=myfile.txt”);

Overall it was what I needed to get the job done :)

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>