Click here to Skip to main content
Click here to Skip to main content

Download File (Firefox Issue)

, 18 Mar 2014 CPOL
Rate this:
Please Sign up or sign in to vote.
Issue in downloading file from asp.net

Description

When we download files from some Asp.net Page using the Response Header. If the file name contains any space then In Firefox it gets only the first word from file name and make it available to download, so after downloading the file due to lack of File Extension, a user faces problem in opening of the file. Also file would be in improper name.

Cause of Problem

Normally we use following line of code in our application...

Response.AddHeader("Content-Disposition", "attachment; filename=" + filename); 

This will skipped the following words from the file name

ex. If file name is : ABC MNO XYZ.xls then browser will download file with name ABC without extension.

Resolution

We can use following line of code which works properly in any browser...

Response.AddHeader("Content-Disposition", "attachment; filename=\"" + filename + "\"");  

This will download file with full name.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Nipesh Shah
Software Developer
India India
No Biography provided

Comments and Discussions

 
-- There are no messages in this forum --
| Advertise | Privacy | Mobile
Web02 | 2.8.141015.1 | Last Updated 18 Mar 2014
Article Copyright 2014 by Nipesh Shah
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid