Monday, 15 August 2011

asp.net - File could not be found error downloading file in Internet Explorer -



asp.net - File could not be found error downloading file in Internet Explorer -

i'm having problems when trying utilize open alternative in net explorer when serving excel document asp.net web app.

response.addheader("content-disposition", "attachment;filename=" + filename.replace(",", "") + ".xls"); response.charset = string.empty; response.contenttype = "application/vnd.xls"; using (stringwriter sw = new stringwriter()) using(htmltextwriter hw = new htmltextwriter(sw)) { gridview.rendercontrol(hw); response.write(sw.tostring()); } response.end();

i didn't write code have noticed if filename length <= 177 works. on >= 118 receive file not found error. i've checked the 118th character 0 doesn't appear this.

any ideas might causing seems work fine in chrome , firefox.

i think here reason: http://support.softartisans.com/kbview_892.aspx

although ntfs or fat32 file systems can back upwards filenames 255 characters, isn't possible utilize file input upload file name long. due way ie inserts chosen file form field. when browse file , select using file input, ie inserts total file path. ie limits 255 characters, counts file path against limit. means if had path length of 55 characters, maximum length of file name take upload 200 characters.

also may helpful: http://stackoverflow.com/a/153400/20126

however, there still limitation (apparently ie-only) on byte-length of file name (a bug, assume). if file name made of single-byte characters, origin of file name truncated. limitation around 160 bytes.

asp.net excel internet-explorer

No comments:

Post a Comment