Forum Moderators: open

Message Too Old, No Replies

Writing objects to the Response

How to get correct file extension?

         

garann

4:44 pm on May 21, 2003 (gmt 0)

10+ Year Member



Hi,

My application has several pages whose function it is to write a Byte array or save an object to the HttpResponse. This is working great, except that when the object is of a type not handled by the browser (in this case, it's a Zip file), the default name in the Save dialog has the .aspx extension.

I'd like to have the files perform as they do now - the page that loads the Zip, for instance, opens a popup responsible for grabbing the Zip, loads it into the response, and automatically closes the popup and displays a Save dialog - but default in the Save dialog to the right extension. Anyone know a way to do it?

Thanks in advance,
g.

WebJoe

5:07 pm on May 21, 2003 (gmt 0)

10+ Year Member



Hi

Just a thought: Have you tried with


Response.ContentType = "application/x-zip-compressed"

the lient should automatically display the corresponding extension, or not?

garann

6:03 pm on May 21, 2003 (gmt 0)

10+ Year Member



WebJoe, that worked perfectly! Thanks for the quick solution. I wonder why application/zip doesn't do the same thing?

WebJoe

7:28 pm on May 21, 2003 (gmt 0)

10+ Year Member



You're welcome, glad I could help

I actually got this mime-type from my windows' registry...afaik there is only one correct mimy-type for each content...in this case it's application/x-zip-compressed. You find a list of multipurpose internet mail extensions here:

ftp*//ftp.isi.edu/in-notes/iana/assignments/media-types/media-types