Allow user to download file and filename on client defaults to no extension

Posted by Andrew on Stack Overflow See other posts from Stack Overflow or by Andrew
Published on 2010-03-29T01:21:43Z Indexed on 2010/03/29 1:23 UTC
Read the original article Hit count: 530

I want the user to be able to download a file from a page and have the filename extension in the Save As dialog box to be defaulted to nothing.

This is the code I'm using:

Response.ContentType = "text/plain"
Response.AppendHeader("content-disposition", "attachment; filename=FILE")
Response.WriteFile("C:\Temp\FILE")
Response.End()

FILE is the actual file. It is saved on the server without any extension.

Currently, the "Save As Type" drop down list in the dialog defaults to "Text Document". How can I make it so that it defaults to "All Files"?

© Stack Overflow or respective owner

Related posts about asp.net-3.5

Related posts about file-download