Thomas Sampson

Pushing files out to the client

Leave a comment

I’ve wanted to look into this for a while. It shows how any server side page (in this instance an aspx c# page) can be seen as a different file type, for example hitting test.aspx returns an mp3 file or perhaps an executable for file download.

This article explains it thoroughly and is achieved by dynamically changing the content type in the header.

http://www.codeproject.com/useritems/textfile.asp

List of content types

".asf" = "video/x-ms-asf"
 ".avi" = "video/avi"
 ".doc" = "application/msword"
 ".zip" = "application/zip"
 ".xls" = "application/vnd.ms-excel"
 ".gif" = "image/gif"
 ".jpg"= "image/jpeg"
 ".wav" = "audio/wav"
 ".mp3" = "audio/mpeg3"
 ".mpg" "mpeg" = "video/mpeg"
 ".rtf" = "application/rtf"
 ".htm", "html" = "text/html"
 ".asp" = "text/asp"

'Handle All Other Files
 = "application/octet-stream"

Advertisements

Author: tomtech999

I have recently graduated with a 1st class degree in MComp Games Software Development at Sheffield Hallam University, focusing primarily on application development in C++, with experience in graphics programming, scripting languages, DVCS/VCS and web technology. In my spare time I enjoy Drumming, Reading and Snowboarding!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s